From e5c060387e1a8e9e60bab750f73c0f79433305f4 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sat, 6 Feb 2021 11:13:07 +0100 Subject: [PATCH] FIXME: the packageProject() makes the problem so the standalone project does not build! and the cmake project config files can't be installed this way? --- CMakeLists.txt | 26 +++++++++++++++----------- standalone/CMakeLists.txt | 3 ++- test/CMakeLists.txt | 2 +- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 82b8fc1..369d218 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,8 @@ target_sources(Greeter PRIVATE ${headers} ${sources}) # FIXME target_compile_options(Greeter PUBLIC "$<$:/permissive->") # Link dependencies (if required) -target_link_libraries(Greeter PRIVATE fmt::fmt-header-only) +target_link_libraries(Greeter PUBLIC fmt::fmt-header-only) +# XXX target_link_libraries(Greeter PUBLIC fmt::fmt) target_include_directories( Greeter PUBLIC $ @@ -80,13 +81,16 @@ target_include_directories( # header paths string(TOLOWER ${PROJECT_NAME}/version.h VERSION_HEADER_LOCATION) -packageProject( - NAME ${PROJECT_NAME} - VERSION ${PROJECT_VERSION} - NAMESPACE ${PROJECT_NAME} - BINARY_DIR ${PROJECT_BINARY_DIR} - INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include - INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION} - VERSION_HEADER "${VERSION_HEADER_LOCATION}" - # XXX DEPENDENCIES fmt -) +# FIXME: CMake Error: install(EXPORT "GreeterTargets" ...) includes target +# "Greeter" which requires target "fmt" that is not in any export set. + +# packageProject( +# NAME ${PROJECT_NAME} +# VERSION ${PROJECT_VERSION} +# NAMESPACE ${PROJECT_NAME} +# BINARY_DIR ${PROJECT_BINARY_DIR} +# INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include +# INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION} +# VERSION_HEADER "${VERSION_HEADER_LOCATION}" +# # XXX DEPENDENCIES fmt +# ) diff --git a/standalone/CMakeLists.txt b/standalone/CMakeLists.txt index f9ebecc..3792677 100644 --- a/standalone/CMakeLists.txt +++ b/standalone/CMakeLists.txt @@ -27,5 +27,6 @@ add_executable(GreeterStandalone ${sources}) # FIXME: WHY? CK # set_target_properties(GreeterStandalone PROPERTIES CXX_STANDARD 17 OUTPUT_NAME "Greeter") +target_compile_features(GreeterStandalone PUBLIC cxx_std_17) -target_link_libraries(GreeterStandalone Greeter::Greeter cxxopts) +target_link_libraries(GreeterStandalone PRIVATE Greeter::Greeter cxxopts) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d6c6c7e..a175b0f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -39,7 +39,7 @@ CPMAddPackage( file(GLOB sources CONFIGURE_DEPENDS source/*.cpp) add_executable(GreeterTests ${sources}) -target_link_libraries(GreeterTests doctest::doctest Greeter::Greeter) +target_link_libraries(GreeterTests PRIVATE doctest::doctest Greeter::Greeter) target_compile_features(GreeterTests PUBLIC cxx_std_17) # enable compiler warnings