diff options
Diffstat (limited to 'Source/CMakeLists.txt')
-rw-r--r-- | Source/CMakeLists.txt | 542 |
1 files changed, 268 insertions, 274 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 95b07cb..c268a92 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -4,7 +4,7 @@ # To ensure maximum portability across various compilers and platforms # deactivate any compiler extensions. Skip this for QNX, where additional # work is needed to build without compiler extensions. -if (NOT CMAKE_SYSTEM_NAME STREQUAL "QNX") +if(NOT CMAKE_SYSTEM_NAME STREQUAL "QNX") set(CMAKE_C_EXTENSIONS FALSE) set(CMAKE_CXX_EXTENSIONS FALSE) endif() @@ -31,70 +31,48 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX") set(CMake_USE_XCOFF_PARSER 1) endif() +# Watcom support +if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(CMAKE_USE_WMAKE 1) +endif() + +set(CMake_STAT_HAS_ST_MTIM ${KWSYS_CXX_STAT_HAS_ST_MTIM_COMPILED}) +set(CMake_STAT_HAS_ST_MTIMESPEC ${KWSYS_CXX_STAT_HAS_ST_MTIMESPEC_COMPILED}) + set(EXECUTABLE_OUTPUT_PATH ${CMake_BIN_DIR}) if(WIN32) # ensure Unicode friendly APIs are used on Windows - add_definitions(-DUNICODE -D_UNICODE) + add_compile_definitions(UNICODE _UNICODE) # minimize windows.h content - add_definitions(-DWIN32_LEAN_AND_MEAN) + add_compile_definitions(WIN32_LEAN_AND_MEAN) endif() # configure the .dox.in file if(CMake_BUILD_DEVELOPER_REFERENCE) - configure_file( - "${CMake_SOURCE_DIR}/Source/dir.dox.in" - "${CMake_BINARY_DIR}/Source/dir.dox" - @ONLY - ) + configure_file(dir.dox.in dir.dox @ONLY) endif() # configure the .h file -configure_file( - "${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in" - "${CMake_BINARY_DIR}/Source/cmConfigure.h" - ) -configure_file( - "${CMake_SOURCE_DIR}/Source/cmVersionConfig.h.in" - "${CMake_BINARY_DIR}/Source/cmVersionConfig.h" - ) -configure_file( - "${CMake_SOURCE_DIR}/Source/CPack/cmCPackConfigure.h.in" - "${CMake_BINARY_DIR}/Source/CPack/cmCPackConfigure.h" - ) +configure_file(cmConfigure.cmake.h.in cmConfigure.h) +configure_file(cmVersionConfig.h.in cmVersionConfig.h) # Tell CMake executable in the build tree where to find the source tree. configure_file( - "${CMake_SOURCE_DIR}/Source/CMakeSourceDir.txt.in" - "${CMake_BINARY_DIR}/CMakeFiles/CMakeSourceDir.txt" @ONLY - ) - -# add the include path to find the .h -include_directories( - "${CMake_BINARY_DIR}/Source" - "${CMake_SOURCE_DIR}/Source" - "${CMake_SOURCE_DIR}/Source/LexerParser" - ${CMAKE_ZLIB_INCLUDES} - ${CMAKE_EXPAT_INCLUDES} - ${CMAKE_TAR_INCLUDES} - ${CMake_HAIKU_INCLUDE_DIRS} + CMakeSourceDir.txt.in + "${CMake_BINARY_DIR}/CMakeFiles/CMakeSourceDir.txt" + @ONLY ) -# Check if we can build the Mach-O parser. -if(CMake_USE_MACH_PARSER) - set(MACH_SRCS cmMachO.h cmMachO.cxx) -endif() - -# Check if we can build the XCOFF parser. -if(CMake_USE_XCOFF_PARSER) - set(XCOFF_SRCS cmXCOFF.h cmXCOFF.cxx) -endif() +# Add a dummy library and add sources later depends on condition +add_library(ManifestLib INTERFACE) # -# Sources for CMakeLib +# create a library used by the command line and the GUI # -set(SRCS +add_library( + CMakeLib # Lexers/Parsers LexerParser/cmCommandArgumentLexer.cxx LexerParser/cmCommandArgumentLexer.h @@ -168,7 +146,9 @@ set(SRCS cmCMakePresetsGraphReadJSON.cxx cmCMakePresetsGraphReadJSONBuildPresets.cxx cmCMakePresetsGraphReadJSONConfigurePresets.cxx + cmCMakePresetsGraphReadJSONPackagePresets.cxx cmCMakePresetsGraphReadJSONTestPresets.cxx + cmCMakePresetsGraphReadJSONWorkflowPresets.cxx cmCommandArgumentParserHelper.cxx cmCommonTargetGenerator.cxx cmCommonTargetGenerator.h @@ -197,6 +177,8 @@ set(SRCS cmCustomCommandLines.cxx cmCustomCommandLines.h cmCustomCommandTypes.h + cmCxxModuleMapper.cxx + cmCxxModuleMapper.h cmDefinitions.cxx cmDefinitions.h cmDependencyProvider.h @@ -367,7 +349,6 @@ set(SRCS cmRulePlaceholderExpander.h cmLocalUnixMakefileGenerator3.cxx cmLocale.h - ${MACH_SRCS} cmMakefile.cxx cmMakefile.h cmMakefileTargetGenerator.cxx @@ -467,7 +448,6 @@ set(SRCS cmWorkerPool.h cmWorkingDirectory.cxx cmWorkingDirectory.h - ${XCOFF_SRCS} cmXMLParser.cxx cmXMLParser.h cmXMLSafe.cxx @@ -543,6 +523,8 @@ set(SRCS cmExecuteProcessCommand.h cmExpandedCommandArgument.cxx cmExpandedCommandArgument.h + cmExperimental.cxx + cmExperimental.h cmExportCommand.cxx cmExportCommand.h cmExportLibraryDependenciesCommand.cxx @@ -567,6 +549,8 @@ set(SRCS cmFindProgramCommand.h cmForEachCommand.cxx cmForEachCommand.h + cmBlockCommand.cxx + cmBlockCommand.h cmFunctionBlocker.cxx cmFunctionBlocker.h cmFunctionCommand.cxx @@ -603,6 +587,8 @@ set(SRCS cmInstallCommand.h cmInstallCommandArguments.cxx cmInstallCommandArguments.h + cmInstallCxxModuleBmiGenerator.cxx + cmInstallCxxModuleBmiGenerator.h cmInstallFilesCommand.cxx cmInstallFilesCommand.h cmInstallProgramsCommand.cxx @@ -721,6 +707,23 @@ set(SRCS cmWhileCommand.h cmWriteFileCommand.cxx cmWriteFileCommand.h + # Ninja support + cmScanDepFormat.cxx + cmGlobalNinjaGenerator.cxx + cmGlobalNinjaGenerator.h + cmNinjaTypes.h + cmLocalNinjaGenerator.cxx + cmLocalNinjaGenerator.h + cmNinjaTargetGenerator.cxx + cmNinjaTargetGenerator.h + cmNinjaNormalTargetGenerator.cxx + cmNinjaNormalTargetGenerator.h + cmNinjaUtilityTargetGenerator.cxx + cmNinjaUtilityTargetGenerator.h + cmNinjaLinkLineComputer.cxx + cmNinjaLinkLineComputer.h + cmNinjaLinkLineDeviceComputer.cxx + cmNinjaLinkLineDeviceComputer.h cm_get_date.h cm_get_date.c @@ -734,102 +737,152 @@ set(SRCS bindexplib.cxx ) +target_include_directories( + CMakeLib + PUBLIC + # add the include path to find the .h + "${CMAKE_CURRENT_BINARY_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/LexerParser" + ${CMake_HAIKU_INCLUDE_DIRS} + ) +target_link_libraries( + CMakeLib + PUBLIC + cmstd + cmsys + CURL::libcurl + EXPAT::EXPAT + JsonCpp::JsonCpp + $<TARGET_NAME_IF_EXISTS:kwiml::kwiml> + LibArchive::LibArchive + LibRHash::LibRHash + LibUV::LibUV + Threads::Threads + ZLIB::ZLIB + ) -SET_PROPERTY(SOURCE cmProcessOutput.cxx cmWindowsRegistry.cxx APPEND PROPERTY COMPILE_DEFINITIONS - KWSYS_ENCODING_DEFAULT_CODEPAGE=${KWSYS_ENCODING_DEFAULT_CODEPAGE}) +# Check if we can build the Mach-O parser. +if(CMake_USE_MACH_PARSER) + target_sources( + CMakeLib + PRIVATE + cmMachO.h + cmMachO.cxx + ) +endif() + +# Check if we can build the XCOFF parser. +if(CMake_USE_XCOFF_PARSER) + target_sources( + CMakeLib + PRIVATE + cmXCOFF.h + cmXCOFF.cxx + ) +endif() # Xcode only works on Apple if(APPLE) - set(SRCS ${SRCS} - cmXCodeObject.cxx - cmXCode21Object.cxx - cmXCodeScheme.cxx - cmGlobalXCodeGenerator.cxx - cmGlobalXCodeGenerator.h - cmLocalXCodeGenerator.cxx - cmLocalXCodeGenerator.h) + target_sources( + CMakeLib + PRIVATE + cmXCodeObject.cxx + cmXCode21Object.cxx + cmXCodeScheme.cxx + cmGlobalXCodeGenerator.cxx + cmGlobalXCodeGenerator.h + cmLocalXCodeGenerator.cxx + cmLocalXCodeGenerator.h + ) endif() - -if (WIN32) - set(SRCS ${SRCS} - cmCallVisualStudioMacro.cxx - cmCallVisualStudioMacro.h +if(WIN32) + target_sources( + CMakeLib + PRIVATE + cmCallVisualStudioMacro.cxx + cmCallVisualStudioMacro.h ) if(NOT UNIX) - set(SRCS ${SRCS} - cmGlobalBorlandMakefileGenerator.cxx - cmGlobalBorlandMakefileGenerator.h - cmGlobalMSYSMakefileGenerator.cxx - cmGlobalMinGWMakefileGenerator.cxx - cmGlobalNMakeMakefileGenerator.cxx - cmGlobalNMakeMakefileGenerator.h - cmGlobalJOMMakefileGenerator.cxx - cmGlobalJOMMakefileGenerator.h - cmGlobalVisualStudio71Generator.cxx - cmGlobalVisualStudio71Generator.h - cmGlobalVisualStudio7Generator.cxx - cmGlobalVisualStudio7Generator.h - cmGlobalVisualStudio8Generator.cxx - cmGlobalVisualStudio8Generator.h - cmGlobalVisualStudio9Generator.cxx - cmGlobalVisualStudio9Generator.h - cmVisualStudioGeneratorOptions.h - cmVisualStudioGeneratorOptions.cxx - cmVsProjectType.h - cmVisualStudio10TargetGenerator.h - cmVisualStudio10TargetGenerator.cxx - cmLocalVisualStudio10Generator.cxx - cmLocalVisualStudio10Generator.h - cmGlobalVisualStudio10Generator.h - cmGlobalVisualStudio10Generator.cxx - cmGlobalVisualStudio11Generator.h - cmGlobalVisualStudio11Generator.cxx - cmGlobalVisualStudio12Generator.h - cmGlobalVisualStudio12Generator.cxx - cmGlobalVisualStudio14Generator.h - cmGlobalVisualStudio14Generator.cxx - cmGlobalVisualStudioGenerator.cxx - cmGlobalVisualStudioGenerator.h - cmGlobalVisualStudioVersionedGenerator.h - cmGlobalVisualStudioVersionedGenerator.cxx - cmIDEFlagTable.h - cmIDEOptions.cxx - cmIDEOptions.h - cmLocalVisualStudio7Generator.cxx - cmLocalVisualStudio7Generator.h - cmLocalVisualStudioGenerator.cxx - cmLocalVisualStudioGenerator.h - cmVisualStudioSlnData.h - cmVisualStudioSlnData.cxx - cmVisualStudioSlnParser.h - cmVisualStudioSlnParser.cxx - cmVisualStudioWCEPlatformParser.h - cmVisualStudioWCEPlatformParser.cxx - cmVSSetupHelper.cxx - cmVSSetupHelper.h + target_sources( + CMakeLib + PRIVATE + cmGlobalBorlandMakefileGenerator.cxx + cmGlobalBorlandMakefileGenerator.h + cmGlobalMSYSMakefileGenerator.cxx + cmGlobalMinGWMakefileGenerator.cxx + cmGlobalNMakeMakefileGenerator.cxx + cmGlobalNMakeMakefileGenerator.h + cmGlobalJOMMakefileGenerator.cxx + cmGlobalJOMMakefileGenerator.h + cmGlobalVisualStudio71Generator.cxx + cmGlobalVisualStudio71Generator.h + cmGlobalVisualStudio7Generator.cxx + cmGlobalVisualStudio7Generator.h + cmGlobalVisualStudio8Generator.cxx + cmGlobalVisualStudio8Generator.h + cmGlobalVisualStudio9Generator.cxx + cmGlobalVisualStudio9Generator.h + cmVisualStudioGeneratorOptions.h + cmVisualStudioGeneratorOptions.cxx + cmVsProjectType.h + cmVisualStudio10TargetGenerator.h + cmVisualStudio10TargetGenerator.cxx + cmLocalVisualStudio10Generator.cxx + cmLocalVisualStudio10Generator.h + cmGlobalVisualStudio10Generator.h + cmGlobalVisualStudio10Generator.cxx + cmGlobalVisualStudio11Generator.h + cmGlobalVisualStudio11Generator.cxx + cmGlobalVisualStudio12Generator.h + cmGlobalVisualStudio12Generator.cxx + cmGlobalVisualStudio14Generator.h + cmGlobalVisualStudio14Generator.cxx + cmGlobalVisualStudioGenerator.cxx + cmGlobalVisualStudioGenerator.h + cmGlobalVisualStudioVersionedGenerator.h + cmGlobalVisualStudioVersionedGenerator.cxx + cmIDEFlagTable.h + cmIDEOptions.cxx + cmIDEOptions.h + cmLocalVisualStudio7Generator.cxx + cmLocalVisualStudio7Generator.h + cmLocalVisualStudioGenerator.cxx + cmLocalVisualStudioGenerator.h + cmVisualStudioSlnData.h + cmVisualStudioSlnData.cxx + cmVisualStudioSlnParser.h + cmVisualStudioSlnParser.cxx + cmVisualStudioWCEPlatformParser.h + cmVisualStudioWCEPlatformParser.cxx + cmVSSetupHelper.cxx + cmVSSetupHelper.h ) # Add a manifest file to executables on Windows to allow for # GetVersion to work properly on Windows 8 and above. - set(MANIFEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake.version.manifest) + target_sources(ManifestLib INTERFACE cmake.version.manifest) endif() -endif () +endif() # Watcom support -if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin") - set_property(SOURCE cmake.cxx APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_USE_WMAKE) - list(APPEND SRCS - cmGlobalWatcomWMakeGenerator.cxx - cmGlobalWatcomWMakeGenerator.h +if(CMAKE_USE_WMAKE) + target_sources( + CMakeLib + PRIVATE + cmGlobalWatcomWMakeGenerator.cxx + cmGlobalWatcomWMakeGenerator.h ) endif() # GHS support # Works only for windows and linux if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(SRCS ${SRCS} + target_sources( + CMakeLib + PRIVATE cmGlobalGhsMultiGenerator.cxx cmGlobalGhsMultiGenerator.h cmLocalGhsMultiGenerator.cxx @@ -841,104 +894,45 @@ if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux") ) endif() - -# Ninja support -set(SRCS ${SRCS} - cmScanDepFormat.cxx - cmGlobalNinjaGenerator.cxx - cmGlobalNinjaGenerator.h - cmNinjaTypes.h - cmLocalNinjaGenerator.cxx - cmLocalNinjaGenerator.h - cmNinjaTargetGenerator.cxx - cmNinjaTargetGenerator.h - cmNinjaNormalTargetGenerator.cxx - cmNinjaNormalTargetGenerator.h - cmNinjaUtilityTargetGenerator.cxx - cmNinjaUtilityTargetGenerator.h - cmNinjaLinkLineComputer.cxx - cmNinjaLinkLineComputer.h - cmNinjaLinkLineDeviceComputer.cxx - cmNinjaLinkLineDeviceComputer.h - ) - # Temporary variable for tools targets set(_tools) if(WIN32 AND NOT CYGWIN) set_source_files_properties(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501) - add_executable(cmcldeps cmcldeps.cxx ${MANIFEST_FILE}) + add_executable(cmcldeps cmcldeps.cxx) + target_link_libraries(cmcldeps PRIVATE CMakeLib ManifestLib) list(APPEND _tools cmcldeps) - target_link_libraries(cmcldeps CMakeLib) endif() -foreach(v CURL_CA_BUNDLE CURL_CA_PATH) - if(${v}) - set_property(SOURCE cmCurl.cxx APPEND PROPERTY COMPILE_DEFINITIONS ${v}="${${v}}") - endif() -endforeach() - -foreach(check - STAT_HAS_ST_MTIM - STAT_HAS_ST_MTIMESPEC - ) - if(KWSYS_CXX_${check}_COMPILED) # abuse KWSys check cache entry - set(CMake_${check} 1) - else() - set(CMake_${check} 0) - endif() - set_property(SOURCE cmFileTime.cxx APPEND PROPERTY - COMPILE_DEFINITIONS CMake_${check}=${CMake_${check}}) -endforeach() - -# create a library used by the command line and the GUI -add_library(CMakeLib ${SRCS}) -target_link_libraries(CMakeLib cmsys - ${CMAKE_STD_LIBRARY} - ${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES} - ${CMAKE_TAR_LIBRARIES} - ${CMAKE_CURL_LIBRARIES} - ${CMAKE_JSONCPP_LIBRARIES} - ${CMAKE_LIBUV_LIBRARIES} - ${CMAKE_LIBRHASH_LIBRARIES} - ${CMake_KWIML_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ) - if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc") # the atomic instructions are implemented using libatomic on some platforms, # so linking to that may be required check_library_exists(atomic __atomic_fetch_add_4 "" LIBATOMIC_NEEDED) if(LIBATOMIC_NEEDED) - target_link_libraries(CMakeLib atomic) + target_link_libraries(CMakeLib PUBLIC atomic) endif() endif() # On Apple we need CoreFoundation and CoreServices if(APPLE) - target_link_libraries(CMakeLib "-framework CoreFoundation") - target_link_libraries(CMakeLib "-framework CoreServices") + target_link_libraries(CMakeLib PUBLIC "-framework CoreFoundation") + target_link_libraries(CMakeLib PUBLIC "-framework CoreServices") endif() if(WIN32 AND NOT UNIX) # We need the rpcrt4 library on Windows. # We need the crypt32 library on Windows for crypto/cert APIs. - target_link_libraries(CMakeLib rpcrt4 crypt32) + target_link_libraries(CMakeLib PUBLIC rpcrt4 crypt32) endif() target_compile_definitions(CMakeLib PUBLIC ${CLANG_TIDY_DEFINITIONS}) # -# CTestLib -# -include_directories( - "${CMake_SOURCE_DIR}/Source/CTest" - ${CMAKE_CURL_INCLUDES} - ) -# -# Sources for CTestLib +# Build CTestLib # -set(CTEST_SRCS cmCTest.cxx +add_library( + CTestLib + cmCTest.cxx CTest/cmProcess.cxx CTest/cmCTestBinPacker.cxx CTest/cmCTestBuildAndTestHandler.cxx @@ -1005,21 +999,18 @@ set(CTEST_SRCS cmCTest.cxx LexerParser/cmCTestResourceGroupsLexer.h LexerParser/cmCTestResourceGroupsLexer.in.l ) - -# Build CTestLib -add_library(CTestLib ${CTEST_SRCS}) -target_link_libraries(CTestLib CMakeLib ${CMAKE_CURL_LIBRARIES}) - -# -# CPack -# -include_directories( - "${CMake_SOURCE_DIR}/Source/CPack" +target_include_directories( + CTestLib + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/CTest" ) +target_link_libraries(CTestLib PUBLIC CMakeLib) + # -# Sources for CPack +# Build CPackLib # -set(CPACK_SRCS +add_library( + CPackLib CPack/cmCPackArchiveGenerator.cxx CPack/cmCPackComponentGroup.cxx CPack/cmCPackDebGenerator.cxx @@ -1030,9 +1021,7 @@ set(CPACK_SRCS CPack/cmCPackNSISGenerator.cxx CPack/cmCPackNuGetGenerator.cxx CPack/cmCPackSTGZGenerator.cxx - ) -# CPack IFW generator -set(CPACK_SRCS ${CPACK_SRCS} + # CPack IFW generator CPack/IFW/cmCPackIFWCommon.cxx CPack/IFW/cmCPackIFWCommon.h CPack/IFW/cmCPackIFWGenerator.cxx @@ -1044,19 +1033,20 @@ set(CPACK_SRCS ${CPACK_SRCS} CPack/IFW/cmCPackIFWRepository.cxx CPack/IFW/cmCPackIFWRepository.h ) - -if(CYGWIN) - set(CPACK_SRCS ${CPACK_SRCS} - CPack/cmCPackCygwinBinaryGenerator.cxx - CPack/cmCPackCygwinSourceGenerator.cxx - ) -endif() +target_include_directories( + CPackLib + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/CPack" + "${CMAKE_CURRENT_BINARY_DIR}/CPack" + ) +target_link_libraries(CPackLib PUBLIC CMakeLib) option(CPACK_ENABLE_FREEBSD_PKG "Add FreeBSD pkg(8) generator to CPack." OFF) - if(UNIX) - set(CPACK_SRCS ${CPACK_SRCS} - CPack/cmCPackRPMGenerator.cxx + target_sources( + CPackLib + PRIVATE + CPack/cmCPackRPMGenerator.cxx ) # Optionally, try to use pkg(8) @@ -1072,13 +1062,14 @@ if(UNIX) pkg DOC "FreeBSD pkg(8) library") if(FREEBSD_PKG_LIBRARIES) - set(CPACK_SRCS ${CPACK_SRCS} - CPack/cmCPackFreeBSDGenerator.cxx - ) + set(ENABLE_BUILD_FREEBSD_PKG 1) + target_sources(CPackLib PRIVATE CPack/cmCPackFreeBSDGenerator.cxx) + target_include_directories(CPackLib PUBLIC ${FREEBSD_PKG_INCLUDE_DIRS}) + target_link_libraries(CPackLib PUBLIC ${FREEBSD_PKG_LIBRARIES}) endif() endif() - if (NOT FREEBSD_PKG_INCLUDE_DIRS OR NOT FREEBSD_PKG_LIBRARIES) + if(NOT FREEBSD_PKG_INCLUDE_DIRS OR NOT FREEBSD_PKG_LIBRARIES) message(FATAL_ERROR "CPack needs libpkg(3) to produce FreeBSD packages natively.") endif() else() @@ -1088,47 +1079,57 @@ if(UNIX) endif() if(CYGWIN) + target_sources( + CPackLib + PRIVATE + CPack/cmCPackCygwinBinaryGenerator.cxx + CPack/cmCPackCygwinSourceGenerator.cxx + ) find_package(LibUUID) endif() -if(WIN32 OR (CYGWIN AND LibUUID_FOUND)) - set(CPACK_SRCS ${CPACK_SRCS} - CPack/WiX/cmCMakeToWixPath.cxx - CPack/WiX/cmCMakeToWixPath.h - CPack/WiX/cmCPackWIXGenerator.cxx - CPack/WiX/cmCPackWIXGenerator.h - CPack/WiX/cmWIXAccessControlList.cxx - CPack/WiX/cmWIXAccessControlList.h - CPack/WiX/cmWIXDirectoriesSourceWriter.cxx - CPack/WiX/cmWIXDirectoriesSourceWriter.h - CPack/WiX/cmWIXFeaturesSourceWriter.cxx - CPack/WiX/cmWIXFeaturesSourceWriter.h - CPack/WiX/cmWIXFilesSourceWriter.cxx - CPack/WiX/cmWIXFilesSourceWriter.h - CPack/WiX/cmWIXPatch.cxx - CPack/WiX/cmWIXPatch.h - CPack/WiX/cmWIXPatchParser.cxx - CPack/WiX/cmWIXPatchParser.h - CPack/WiX/cmWIXRichTextFormatWriter.cxx - CPack/WiX/cmWIXRichTextFormatWriter.h - CPack/WiX/cmWIXShortcut.cxx - CPack/WiX/cmWIXShortcut.h - CPack/WiX/cmWIXSourceWriter.cxx - CPack/WiX/cmWIXSourceWriter.h + +if(WIN32 OR (CYGWIN AND TARGET LibUUID::LibUUID)) + set(ENABLE_BUILD_WIX_GENERATOR 1) + target_sources( + CPackLib + PRIVATE + CPack/WiX/cmCMakeToWixPath.cxx + CPack/WiX/cmCMakeToWixPath.h + CPack/WiX/cmCPackWIXGenerator.cxx + CPack/WiX/cmCPackWIXGenerator.h + CPack/WiX/cmWIXAccessControlList.cxx + CPack/WiX/cmWIXAccessControlList.h + CPack/WiX/cmWIXDirectoriesSourceWriter.cxx + CPack/WiX/cmWIXDirectoriesSourceWriter.h + CPack/WiX/cmWIXFeaturesSourceWriter.cxx + CPack/WiX/cmWIXFeaturesSourceWriter.h + CPack/WiX/cmWIXFilesSourceWriter.cxx + CPack/WiX/cmWIXFilesSourceWriter.h + CPack/WiX/cmWIXPatch.cxx + CPack/WiX/cmWIXPatch.h + CPack/WiX/cmWIXPatchParser.cxx + CPack/WiX/cmWIXPatchParser.h + CPack/WiX/cmWIXRichTextFormatWriter.cxx + CPack/WiX/cmWIXRichTextFormatWriter.h + CPack/WiX/cmWIXShortcut.cxx + CPack/WiX/cmWIXShortcut.h + CPack/WiX/cmWIXSourceWriter.cxx + CPack/WiX/cmWIXSourceWriter.h ) + target_link_libraries(CPackLib PUBLIC $<TARGET_NAME_IF_EXISTS:LibUUID::LibUUID>) endif() if(APPLE) - set(CPACK_SRCS ${CPACK_SRCS} - CPack/cmCPackBundleGenerator.cxx - CPack/cmCPackDragNDropGenerator.cxx - CPack/cmCPackPKGGenerator.cxx - CPack/cmCPackProductBuildGenerator.cxx + target_sources( + CPackLib + PRIVATE + CPack/cmCPackBundleGenerator.cxx + CPack/cmCPackDragNDropGenerator.cxx + CPack/cmCPackPKGGenerator.cxx + CPack/cmCPackProductBuildGenerator.cxx ) endif() -# Build CPackLib -add_library(CPackLib ${CPACK_SRCS}) -target_link_libraries(CPackLib CMakeLib) if(APPLE) # Some compilers produce errors in the CoreServices framework headers. # Ideally such errors should be fixed by either the compiler vendor @@ -1136,8 +1137,7 @@ if(APPLE) # If it does not work, build with reduced functionality and warn. check_include_file("CoreServices/CoreServices.h" HAVE_CoreServices) if(HAVE_CoreServices) - set_property(SOURCE CPack/cmCPackDragNDropGenerator.cxx PROPERTY COMPILE_DEFINITIONS HAVE_CoreServices) - target_link_libraries(CPackLib "-framework CoreServices") + target_link_libraries(CPackLib PUBLIC "-framework CoreServices") else() message(WARNING "This compiler does not appear to support\n" " #include <CoreServices/CoreServices.h>\n" @@ -1145,31 +1145,25 @@ if(APPLE) "See CMakeFiles/CMakeError.log for details of the failure.") endif() endif() -if(CYGWIN AND LibUUID_FOUND) - target_link_libraries(CPackLib ${LibUUID_LIBRARIES}) - include_directories(CPackLib ${LibUUID_INCLUDE_DIRS}) - 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_link_libraries(CPackLib ${FREEBSD_PKG_LIBRARIES}) - include_directories(${FREEBSD_PKG_INCLUDE_DIRS}) - add_definitions(-DHAVE_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 ${MANIFEST_FILE}) +add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h) +target_link_libraries(cmake PRIVATE CMakeLib ManifestLib) list(APPEND _tools cmake) -target_link_libraries(cmake CMakeLib) # Build CTest executable -add_executable(ctest ctest.cxx ${MANIFEST_FILE}) +add_executable(ctest ctest.cxx) +target_link_libraries(ctest PRIVATE CTestLib ManifestLib) list(APPEND _tools ctest) -target_link_libraries(ctest CTestLib) # Build CPack executable -add_executable(cpack CPack/cpack.cxx ${MANIFEST_FILE}) +add_executable(cpack CPack/cpack.cxx) +target_link_libraries(cpack PRIVATE CPackLib ManifestLib) list(APPEND _tools cpack) -target_link_libraries(cpack CPackLib) # Curses GUI if(BUILD_CursesDialog) @@ -1182,8 +1176,8 @@ if(BUILD_QtDialog) add_subdirectory(QtDialog) endif() -include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL) -include (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL) +include(${CMAKE_CURRENT_BINARY_DIR}/LocalUserOptions.cmake OPTIONAL) +include(${CMAKE_CURRENT_SOURCE_DIR}/LocalUserOptions.cmake OPTIONAL) if(WIN32) # Compute the binary version that appears in the RC file. Version @@ -1202,14 +1196,14 @@ if(WIN32) set(CMake_RCVERSION_STR ${CMake_VERSION}) # Add Windows executable version information. - configure_file("CMakeVersion.rc.in" "CMakeVersion.rc" @ONLY) + configure_file(CMakeVersion.rc.in CMakeVersion.rc @ONLY) # We use a separate object library for this to work around a limitation of # MinGW's windres tool with spaces in the path to the include directories. add_library(CMakeVersion OBJECT "${CMAKE_CURRENT_BINARY_DIR}/CMakeVersion.rc") set_property(TARGET CMakeVersion PROPERTY INCLUDE_DIRECTORIES "") - foreach(_tool ${_tools}) - target_sources(${_tool} PRIVATE $<TARGET_OBJECTS:CMakeVersion>) + foreach(_tool IN LISTS _tools) + target_link_libraries(${_tool} PRIVATE CMakeVersion) endforeach() endif() @@ -1220,7 +1214,7 @@ endif() # Install tools -foreach(_tool ${_tools}) +foreach(_tool IN LISTS _tools) CMake_OPTIONAL_COMPONENT(${_tool}) install(TARGETS ${_tool} DESTINATION ${CMAKE_BIN_DIR} ${COMPONENT}) endforeach() |