From b2bb5e9d64c07492e0c6c8a4d17bacf766c06987 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 18 Jun 2026 21:30:38 +0200 Subject: cmake: prettify CMakeLists.txt files --- CMakeLists.txt | 3 ++- src/CMakeLists.txt | 5 ++++- test/unit_tests/CMakeLists.txt | 25 ++++++++++++++++++------- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79ed508..469562c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,5 +37,6 @@ if(DOXYGEN_FOUND) doxygen_add_docs(winapi_common_docs README.md ${winapi_common_include} - ${winapi_common_src}) + ${winapi_common_src} + ) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b981652..56c035e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,7 +5,10 @@ file(GLOB winapi_common_src CONFIGURE_DEPENDS "*.cpp") add_library(winapi_common ${winapi_common_include} ${winapi_common_src}) target_include_directories(winapi_common PUBLIC ../include) target_link_libraries(winapi_common PRIVATE winapi_utf8) -target_link_libraries(winapi_common PUBLIC Boost::disable_autolinking Boost::boost) +target_link_libraries(winapi_common PUBLIC + Boost::disable_autolinking + Boost::boost +) install(TARGETS winapi_common ARCHIVE DESTINATION lib) install(DIRECTORY ../include/winapi DESTINATION include) diff --git a/test/unit_tests/CMakeLists.txt b/test/unit_tests/CMakeLists.txt index 319b563..bdb13c6 100644 --- a/test/unit_tests/CMakeLists.txt +++ b/test/unit_tests/CMakeLists.txt @@ -6,21 +6,28 @@ file(GLOB unit_tests_src CONFIGURE_DEPENDS "*.cpp" "*.h" "*.hpp" "*.rc") add_executable(unit_tests ${unit_tests_src} ${shared_src}) set_target_properties(unit_tests PROPERTIES OUTPUT_NAME winapi-common-unit-tests) target_link_libraries(unit_tests PRIVATE winapi_common winapi_utf8) -target_link_libraries(unit_tests PRIVATE Boost::disable_autolinking Boost::unit_test_framework) +target_link_libraries(unit_tests PRIVATE + Boost::disable_autolinking + Boost::unit_test_framework +) install(TARGETS unit_tests RUNTIME DESTINATION bin) file(GLOB worker_src CONFIGURE_DEPENDS "worker/*.cpp") add_executable(worker ${worker_src} ${shared_src}) set_target_properties(worker PROPERTIES OUTPUT_NAME winapi-common-test-worker) target_link_libraries(worker PRIVATE winapi_common winapi_utf8) -target_link_libraries(worker PRIVATE Boost::disable_autolinking Boost::boost) +target_link_libraries(worker PRIVATE + Boost::disable_autolinking + Boost::boost +) install(TARGETS worker RUNTIME DESTINATION bin) if(MSVC) install(FILES $ $ - DESTINATION bin OPTIONAL) + DESTINATION bin OPTIONAL + ) endif() find_package(Python3 REQUIRED COMPONENTS Interpreter) @@ -33,14 +40,16 @@ add_test(NAME unit_tests COMMAND unit_tests --run_test=!console_tests,process_console_tests -- "--echo_exe=$" - "--worker_exe=$") + "--worker_exe=$" +) add_test(NAME unit_tests_report COMMAND Python3::Interpreter "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/tools/ctest-driver.py" grep --pass-regex [=[^\*\*\* No errors detected$]=] -- - "$/unit_tests_report.txt") + "$/unit_tests_report.txt" +) add_test(NAME console_tests COMMAND Python3::Interpreter "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/tools/ctest-driver.py" @@ -55,11 +64,13 @@ add_test(NAME console_tests COMMAND Python3::Interpreter --run_test=console_tests,process_console_tests -- "--echo_exe=$" - "--worker_exe=$") + "--worker_exe=$" +) add_test(NAME console_tests_report COMMAND Python3::Interpreter "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/tools/ctest-driver.py" grep --pass-regex [=[^\*\*\* No errors detected$]=] -- - "$/console_tests_report.txt") + "$/console_tests_report.txt" +) -- cgit v1.3