summaryrefslogtreecommitdiffstats
path: root/Source/CMakeLists.txt
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2022-08-21 03:59:50 (GMT)
committerBrad King <brad.king@kitware.com>2022-09-22 13:24:48 (GMT)
commit626136ad4dbf13f560d8c55c5d50f0488e8db966 (patch)
treeb3dec660f4232bfd32cfb0b000ed94b6acdb1295 /Source/CMakeLists.txt
parentf31c784a2d1742dbe1cf321c1c0dd225ce3941a0 (diff)
downloadCMake-626136ad4dbf13f560d8c55c5d50f0488e8db966.zip
CMake-626136ad4dbf13f560d8c55c5d50f0488e8db966.tar.gz
CMake-626136ad4dbf13f560d8c55c5d50f0488e8db966.tar.bz2
Build: Use imported `LibUUID::LibUUID` target instead of variables
Also, simplify preprocessor condition to enable WIX CPack generator.
Diffstat (limited to 'Source/CMakeLists.txt')
-rw-r--r--Source/CMakeLists.txt36
1 files changed, 19 insertions, 17 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index de3ce15..2cf4d1c 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -62,7 +62,6 @@ endif()
# configure the .h file
configure_file(cmConfigure.cmake.h.in cmConfigure.h)
configure_file(cmVersionConfig.h.in cmVersionConfig.h)
-configure_file(CPack/cmCPackConfigure.h.in CPack/cmCPackConfigure.h)
# Tell CMake executable in the build tree where to find the source tree.
configure_file(
@@ -1041,18 +1040,14 @@ add_library(
CPack/IFW/cmCPackIFWRepository.cxx
CPack/IFW/cmCPackIFWRepository.h
)
-target_include_directories(CPackLib PUBLIC "${CMake_SOURCE_DIR}/Source/CPack")
+target_include_directories(
+ CPackLib
+ PUBLIC
+ "${CMAKE_CURRENT_SOURCE_DIR}/CPack"
+ "${CMAKE_CURRENT_BINARY_DIR}/CPack"
+ )
target_link_libraries(CPackLib PUBLIC CMakeLib)
-if(CYGWIN)
- target_sources(
- CPackLib
- PUBLIC
- CPack/cmCPackCygwinBinaryGenerator.cxx
- CPack/cmCPackCygwinSourceGenerator.cxx
- )
-endif()
-
option(CPACK_ENABLE_FREEBSD_PKG "Add FreeBSD pkg(8) generator to CPack." OFF)
if(UNIX)
@@ -1089,9 +1084,17 @@ if(UNIX)
endif()
if(CYGWIN)
+ target_sources(
+ CPackLib
+ PUBLIC
+ CPack/cmCPackCygwinBinaryGenerator.cxx
+ CPack/cmCPackCygwinSourceGenerator.cxx
+ )
find_package(LibUUID)
endif()
-if(WIN32 OR (CYGWIN AND LibUUID_FOUND))
+
+if(WIN32 OR (CYGWIN AND TARGET LibUUID::LibUUID))
+ set(ENABLE_BUILD_WIX_GENERATOR 1)
target_sources(
CPackLib
PUBLIC
@@ -1118,6 +1121,7 @@ if(WIN32 OR (CYGWIN AND LibUUID_FOUND))
CPack/WiX/cmWIXSourceWriter.cxx
CPack/WiX/cmWIXSourceWriter.h
)
+ target_link_libraries(CPackLib PUBLIC $<TARGET_NAME_IF_EXISTS:LibUUID::LibUUID>)
endif()
if(APPLE)
@@ -1147,16 +1151,14 @@ if(APPLE)
"See CMakeFiles/CMakeError.log for details of the failure.")
endif()
endif()
-if(CYGWIN AND LibUUID_FOUND)
- target_include_directories(CPackLib PUBLIC ${LibUUID_INCLUDE_DIRS})
- target_link_libraries(CPackLib PUBLIC ${LibUUID_LIBRARIES})
- set_property(SOURCE CPack/cmCPackGeneratorFactory.cxx PROPERTY COMPILE_DEFINITIONS HAVE_LIBUUID)
-endif()
if(CPACK_ENABLE_FREEBSD_PKG AND FREEBSD_PKG_INCLUDE_DIRS AND FREEBSD_PKG_LIBRARIES)
target_include_directories(CPackLib PUBLIC ${FREEBSD_PKG_INCLUDE_DIRS})
target_link_libraries(CPackLib PUBLIC ${FREEBSD_PKG_LIBRARIES})
target_compile_definitions(CPackLib PUBLIC HAVE_FREEBSD_PKG)
endif()
+# Render config header file for CPackLib
+configure_file(CPack/cmCPackConfigure.h.in CPack/cmCPackConfigure.h)
+
# Build CMake executable
add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h)