aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-04-06 22:07:33 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-04-06 22:09:47 +0300
commita70f6cd1ba7fae777b16aab9a677365e4414c938 (patch)
treedb96eaa92396d8404ee77996c75fbf14bc2d1e12
parentcmake: check CTest tests output (diff)
downloadwinapi-utf8-a70f6cd1ba7fae777b16aab9a677365e4414c938.tar.gz
winapi-utf8-a70f6cd1ba7fae777b16aab9a677365e4414c938.zip
cmake: slight CMakeLists.txt refactoring
-rw-r--r--CMakeLists.txt9
-rw-r--r--test/CMakeLists.txt6
2 files changed, 6 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9408887..d2e111a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,26 +1,25 @@
cmake_minimum_required(VERSION 3.5) # for Boost::* imported targets
project(winapi_utf8 CXX)
-
enable_testing()
include(cmake/common.cmake)
+if(NOT TARGET SafeInt)
+ add_subdirectory(3rdparty/microsoft/SafeInt EXCLUDE_FROM_ALL)
+endif()
+
file(GLOB_RECURSE winapi_utf8_include "include/*.hpp")
file(GLOB winapi_utf8_src "src/*.cpp")
add_library(winapi_utf8 ${winapi_utf8_include} ${winapi_utf8_src})
target_include_directories(winapi_utf8 PUBLIC include)
-
-add_subdirectory(3rdparty/microsoft/SafeInt EXCLUDE_FROM_ALL)
target_link_libraries(winapi_utf8 PRIVATE SafeInt)
-
# Vista is the lower bound (due to WC_ERR_INVALID_CHARS):
if(MINGW)
target_compile_definitions(winapi_utf8 PRIVATE
NTDDI_VERSION=NTDDI_VISTA
_WIN32_WINNT=_WIN32_WINNT_VISTA)
endif()
-
install(TARGETS winapi_utf8 ARCHIVE DESTINATION lib)
install(DIRECTORY include/winapi DESTINATION include)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index d062b19..bf023a6 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,12 +1,10 @@
+find_package(Boost REQUIRED COMPONENTS unit_test_framework)
+
file(GLOB unit_tests_src "*.cpp")
add_executable(unit_tests ${unit_tests_src})
set_target_properties(unit_tests PROPERTIES OUTPUT_NAME winapi-utf8-unit-tests)
-
target_link_libraries(unit_tests PRIVATE winapi_utf8)
-
-find_package(Boost REQUIRED COMPONENTS unit_test_framework)
target_link_libraries(unit_tests PRIVATE Boost::disable_autolinking Boost::unit_test_framework)
-
install(TARGETS unit_tests RUNTIME DESTINATION bin)
install_pdbs(TARGETS unit_tests DESTINATION bin)