rttr
rttr copied to clipboard
Disabling BUILD_RTTR_DYNAMIC causes error on generating project files
Hello, When I try to disable BUILD_RTTR_DYNAMIC option on cmake generator, it emits a lot of errors about missing target as follows
CMake Error at src/unit_tests/CMakeLists.txt:47 (add_executable):
Target "unit_tests" links to target "RTTR::Core" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at src/examples/json_serialization/CMakeLists.txt:42 (add_executable):
Target "json_example" links to target "RTTR::Core" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at src/examples/library_loading/library_loader_example/CMakeLists.txt:42 (add_executable):
Target "library_loader_example" links to target "RTTR::Core" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at src/examples/scripting/CMakeLists.txt:42 (add_executable):
Target "scripting_example" links to target "RTTR::Core" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at src/unit_tests/CMakeLists.txt:49 (add_dependencies):
The dependency target "RTTR::Core" of target "unit_tests" does not exist.
CMake Error at src/examples/json_serialization/CMakeLists.txt:42 (add_executable):
Target "json_example" links to target "RTTR::Core" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at src/unit_tests/base_library/CMakeLists.txt:45 (add_library):
Target "unit_test_base" links to target "RTTR::Core" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at src/unit_tests/plugin/CMakeLists.txt:45 (add_library):
Target "unit_test_plugin" links to target "RTTR::Core" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
I figure that's because there's no link to RTTR::Core_Lib_STL in those projects. Is there a reason for the missing link?
I've also submitted a PR that disables Benchmarks, Unit Tests, and Examples if the user disables BUILD_RTTR_DYNAMIC, you might want to take a look. Fix disabling dynamic/shared version of RTTR #247
I believe this is a because of how the example projects are built. I built them with the static library, but had to update the CMakeLists.txt for each project. I think the better route would be to update the unit tests, examples, etc to include the correct library in the target_link_libraries section based on the options