From 6f022bbbe7651f114fba2b786d4f01e827806ab8 Mon Sep 17 00:00:00 2001 From: Mario Badr Date: Wed, 30 Nov 2016 10:10:30 -0500 Subject: [PATCH] Use INTERFACE to pass on unicode dependency Linking the cxxopts library with the unicode libraries and specifying INTERFACE should ensure executables that link with cxxopts will also link with the unicode libraries. --- CMakeLists.txt | 5 +++++ src/CMakeLists.txt | 2 +- test/CMakeLists.txt | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b4dfbf3..8007b5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,11 @@ target_include_directories( cxxopts INTERFACE include/ ) +target_link_libraries( + cxxopts + INTERFACE ${CXXOPTS_LINKER_LIBRARIES} + ) + add_subdirectory(src) add_subdirectory(test) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 030ca95..9a79b08 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,7 +20,7 @@ if(CXXOPTS_BUILD_EXAMPLES) add_executable(example example.cpp) - target_link_libraries(example cxxopts ${CXXOPTS_LINKER_LIBRARIES}) + target_link_libraries(example cxxopts) if (MSVC) target_compile_options(example PUBLIC /W2) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c7a09e1..19aa960 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ if (CXXOPTS_BUILD_TESTS) add_executable(options_test options.cpp) - target_link_libraries(options_test cxxopts ${CXXOPTS_LINKER_LIBRARIES}) + target_link_libraries(options_test cxxopts) if (MSVC) target_compile_options(options_test PUBLIC /W2)