From dad26824ae7c9556990c05f14e5e8670478f0906 Mon Sep 17 00:00:00 2001 From: Dominik Berner Date: Sat, 20 Apr 2024 10:25:28 +0000 Subject: [PATCH] Find system libs --- chapter04/ex07_pack_nsis_standalone/CMakeLists.txt | 10 +++++++++- .../ex07_pack_nsis_standalone/library/CMakeLists.txt | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/chapter04/ex07_pack_nsis_standalone/CMakeLists.txt b/chapter04/ex07_pack_nsis_standalone/CMakeLists.txt index d9a8fe2..447f8af 100644 --- a/chapter04/ex07_pack_nsis_standalone/CMakeLists.txt +++ b/chapter04/ex07_pack_nsis_standalone/CMakeLists.txt @@ -18,11 +18,19 @@ endif() add_subdirectory(executable) add_subdirectory(library) +include(InstallRequiredSystemLibraries) +install(TARGETS ch4_ex07_executable + RUNTIME_DEPENDENCIES + PRE_EXCLUDE_REGEXES "api-ms-.*" "ext-ms-.*" + POST_EXCLUDE_REGEXES ".*system32/.*\\.dll" + DIRECTORIES "${RUNTIME_DIRS}") + + # We will not explicitly specify project name and version here and # let CPack to get project name and version from the project() set(CPACK_PACKAGE_VENDOR "CBP Authors") # Enable DEB, RPM and TBZ2 generators by default -set(CPACK_GENERATOR "DEB;TBZ2;TGZ;STGZ") +set(CPACK_GENERATOR "NSIS") # Use all available cores when parallelism is supported set(CPACK_THREADS 0) # The DEB generator requires CPACK_DEBIAN_PACKAGE_MAINTAINER diff --git a/chapter04/ex07_pack_nsis_standalone/library/CMakeLists.txt b/chapter04/ex07_pack_nsis_standalone/library/CMakeLists.txt index 319b2c6..9d1b5a2 100644 --- a/chapter04/ex07_pack_nsis_standalone/library/CMakeLists.txt +++ b/chapter04/ex07_pack_nsis_standalone/library/CMakeLists.txt @@ -12,7 +12,7 @@ project( LANGUAGES CXX) # Define the executable that will consume the ch4_ex05_lib package -add_library(ch4_ex07_library STATIC src/lib.cpp) +add_library(ch4_ex07_library SHARED src/lib.cpp) # Set the required C++ standard for the target target_compile_features(ch4_ex07_library PRIVATE cxx_std_11)