* remove biicode support The company/startup died in 2015 and the open source project seems to be dead as well. * define compiler warning flags globally instead of locally for every binary * add support for cmake's find_package() (refs #52) This rewrite of the main CMakeLists.txt cleans up the way ICU flags are attached to the library target and adds the cmake helper files (cxxopts-config.cmake, cxxopts-config-version.cmake, cxxopts-targets.cmake) which are needed for exporting the cxxopts target. Cmake's find_package command uses these files when the library is consumed by another project. Additionally, two new tests have been added which build the example application via add_subdirectory and find_package. * removed target_sources from interface library Adding target_sources to interface libraries and exporting them is not supported in CMake 3.1 and 3.2. Furthermore, since it is a header, it is not needed at all. * use the *_LDFLAGS instead of *_LIBARIES when linking ICU The LIBRARIES variable seems to contain only the name and not the full path.
33 lines
1.2 KiB
CMake
33 lines
1.2 KiB
CMake
if (CXXOPTS_BUILD_TESTS)
|
|
add_executable(options_test main.cpp options.cpp)
|
|
target_link_libraries(options_test cxxopts)
|
|
add_test(options options_test)
|
|
|
|
# test if the targets are findable from the build directory
|
|
add_test(find-package-test ${CMAKE_CTEST_COMMAND}
|
|
-C ${CMAKE_BUILD_TYPE}
|
|
--build-and-test
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/find-package-test"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/find-package-test"
|
|
--build-generator ${CMAKE_GENERATOR}
|
|
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
|
|
--build-options
|
|
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
|
|
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
|
|
"-Dcxxopts_DIR=${PROJECT_BINARY_DIR}"
|
|
)
|
|
|
|
# test if the targets are findable when add_subdirectory is used
|
|
add_test(add-subdirectory-test ${CMAKE_CTEST_COMMAND}
|
|
-C ${CMAKE_BUILD_TYPE}
|
|
--build-and-test
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/add-subdirectory-test"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/add-subdirectory-test"
|
|
--build-generator ${CMAKE_GENERATOR}
|
|
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
|
|
--build-options
|
|
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
|
|
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
|
|
)
|
|
endif()
|