This is because target_link_options was added in v3.13
So this wouldn't build with cmake v3.12
Likewise in CMAKE_CXX_STANDARD only supports value of 17 starting with
cmake v3.9
So the test wouldn't build properly with cmake v3.6
(cherry picked from commit 5c12bd2287)
The CMake buildsystem should be completely reviewed to properly match
what is done by SCons, instead of making its own arbitrary decisions on
how godot-cpp should be compiled.
Currently the SCons setup doesn't include warning options, so CMake
shouldn't either. Options similar to upstream Godot's SCons setup could
be added, and then replicated for CMake.
(cherry picked from commit 41517eacb1)
Makes all include directories consistent.
Turns GODOT_CPP_SYSTEM_HEADERS ON by default since that's what was already being done for ${GODOT_GDEXTENSION_DIR}.
From the cmake docs:
"This may have effects such as suppressing warnings or skipping the contained headers in dependency calculations (see compiler documentation). Additionally, system include directories are searched after normal include directories regardless of the order specified."
Addresses part of #999
Changes the `<godot/gdextension_interface.h>` include to simply
`<gdextension_interface.h>`.
Refactor and better document the SCons and CMake logic around setting
the paths to the header and API JSON file.
Non-exhaustive list of case-sensitive renames:
GDExtension -> GDNative
GDNATIVE -> GDEXTENSION
gdextension -> gdnative
ExtensionExtension -> Extension (for where there was GDNativeExtension)
EXTENSION_EXTENSION -> EXTENSION (for where there was GDNATIVE_EXTENSION)
gdnlib -> gdextension
gdn_interface -> gde_interface
gdni -> gde_interface
- instead of setting globals which can effect other projects including this as a subdirectory, set them on the target if possible
- add "CONFIGURE_DEPENDS" to GLOBs to check for changes
- update required CMake version to 3.12 (still ancient - 2018) to support these
* Attach debug flags to the target and mark as `PUBLIC`. This will allow all
projects that use bindings not to add the same defines manually.
* Use generator-expressions to support multiconfig generators (such as
MSVC).
* Remove excplitic `NDEBUG` and `_DEBUG` flags, CMake handles it
automatically.
changes so this cmake file can be used as a subdirectory
```
add_subdirectory(godot-cpp)
project(project-name)
add_library(project-name SHARED src/init.cpp)
target_link_libraries(project-name godot-cpp)
```