diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Compiler/Clang.cmake | 2 | ||||
-rw-r--r-- | Modules/Compiler/GNU.cmake | 8 | ||||
-rw-r--r-- | Modules/Compiler/Intel.cmake | 7 | ||||
-rw-r--r-- | Modules/FindLibLZMA.cmake | 45 | ||||
-rw-r--r-- | Modules/GNUInstallDirs.cmake | 3 | ||||
-rw-r--r-- | Modules/GetPrerequisites.cmake | 2 | ||||
-rwxr-xr-x | Modules/Internal/CPack/CPack.STGZ_Header.sh.in | 22 | ||||
-rw-r--r-- | Modules/Platform/Windows-Clang.cmake | 7 | ||||
-rw-r--r-- | Modules/Platform/Windows-Embarcadero.cmake | 7 | ||||
-rw-r--r-- | Modules/Platform/Windows-MSVC.cmake | 9 |
10 files changed, 95 insertions, 17 deletions
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index c3f13f3..45c33fb 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -96,5 +96,7 @@ else() set(CMAKE_${lang}_ARCHIVE_FINISH_IPO "\"${__ranlib}\" <TARGET>" ) + + set(CMAKE_PCH_PROLOGUE "#pragma clang system_header") endmacro() endif() diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 6b1bd3a..e0ff174 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -11,6 +11,9 @@ set(__COMPILER_GNU 1) include(Compiler/CMakeCommonCompilerMacros) include(Internal/CMakeCheckCompilerFlag) +set(__pch_header_C "c-header") +set(__pch_header_CXX "c++-header") + macro(__compiler_gnu lang) # Feature flags. set(CMAKE_${lang}_VERBOSE_FLAG "-v") @@ -104,4 +107,9 @@ macro(__compiler_gnu lang) unset(_COMPILER_ARGS) endif() list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-dM" "-E" "-c" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") + + set(CMAKE_PCH_EXTENSION .gch) + set(CMAKE_PCH_PROLOGUE "#pragma GCC system_header") + set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Winvalid-pch -include <PCH_HEADER>) + set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Winvalid-pch -x ${__pch_header_${lang}} -include <PCH_HEADER>) endmacro() diff --git a/Modules/Compiler/Intel.cmake b/Modules/Compiler/Intel.cmake index f2f16e0..d895ed0 100644 --- a/Modules/Compiler/Intel.cmake +++ b/Modules/Compiler/Intel.cmake @@ -32,5 +32,12 @@ else() unset(_COMPILER_ARGS) endif() list(APPEND CMAKE_${lang}_COMPILER_PREDEFINES_COMMAND "-QdM" "-P" "-Za" "${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp") + + # Precompile Headers + set(CMAKE_PCH_EXTENSION .pchi) + set(CMAKE_LINK_PCH ON) + set(CMAKE_PCH_EPILOGUE "#pragma hdrstop") + set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Winvalid-pch -Wno-pch-messages -pch-use <PCH_FILE> -include <PCH_HEADER>) + set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Winvalid-pch -Wno-pch-messages -pch-create <PCH_FILE> -include <PCH_HEADER>) endmacro() endif() diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake index fc97655..200d6bf 100644 --- a/Modules/FindLibLZMA.cmake +++ b/Modules/FindLibLZMA.cmake @@ -42,7 +42,14 @@ This module will set the following variables in your project: #]=======================================================================] find_path(LIBLZMA_INCLUDE_DIR lzma.h ) -find_library(LIBLZMA_LIBRARY NAMES lzma liblzma) +if(NOT LIBLZMA_LIBRARY) + find_library(LIBLZMA_LIBRARY_RELEASE NAMES lzma liblzma PATH_SUFFIXES lib) + find_library(LIBLZMA_LIBRARY_DEBUG NAMES lzmad liblzmad PATH_SUFFIXES lib) + include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) + select_library_configurations(LIBLZMA) +else() + file(TO_CMAKE_PATH "${LIBLZMA_LIBRARY}" LIBLZMA_LIBRARY) +endif() if(LIBLZMA_INCLUDE_DIR AND EXISTS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h") file(STRINGS "${LIBLZMA_INCLUDE_DIR}/lzma/version.h" LIBLZMA_HEADER_CONTENTS REGEX "#define LZMA_VERSION_[A-Z]+ [0-9]+") @@ -62,9 +69,17 @@ if (LIBLZMA_LIBRARY) include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET}) set(CMAKE_REQUIRED_QUIET ${LibLZMA_FIND_QUIETLY}) - CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER) - CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER) - CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET) + if(NOT LIBLZMA_LIBRARY_RELEASE AND NOT LIBLZMA_LIBRARY_DEBUG) + set(LIBLZMA_LIBRARY_check ${LIBLZMA_LIBRARY}) + elseif(LIBLZMA_LIBRARY_RELEASE) + set(LIBLZMA_LIBRARY_check ${LIBLZMA_LIBRARY_RELEASE}) + elseif(LIBLZMA_LIBRARY_DEBUG) + set(LIBLZMA_LIBRARY_check ${LIBLZMA_LIBRARY_DEBUG}) + endif() + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER) + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER) + CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY_check} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET) + unset(LIBLZMA_LIBRARY_check) set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) endif () @@ -85,7 +100,25 @@ if (LIBLZMA_FOUND) add_library(LibLZMA::LibLZMA UNKNOWN IMPORTED) set_target_properties(LibLZMA::LibLZMA PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${LIBLZMA_INCLUDE_DIR} - IMPORTED_LINK_INTERFACE_LANGUAGES C - IMPORTED_LOCATION ${LIBLZMA_LIBRARY}) + IMPORTED_LINK_INTERFACE_LANGUAGES C) + + if(LIBLZMA_LIBRARY_RELEASE) + set_property(TARGET LibLZMA::LibLZMA APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(LibLZMA::LibLZMA PROPERTIES + IMPORTED_LOCATION_RELEASE "${LIBLZMA_LIBRARY_RELEASE}") + endif() + + if(LIBLZMA_LIBRARY_DEBUG) + set_property(TARGET LibLZMA::LibLZMA APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(LibLZMA::LibLZMA PROPERTIES + IMPORTED_LOCATION_DEBUG "${LIBLZMA_LIBRARY_DEBUG}") + endif() + + if(NOT LIBLZMA_LIBRARY_RELEASE AND NOT LIBLZMA_LIBRARY_DEBUG) + set_target_properties(LibLZMA::LibLZMA PROPERTIES + IMPORTED_LOCATION "${LIBLZMA_LIBRARY}") + endif() endif() endif () diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index 4db4e18..f95e6e2 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -222,7 +222,8 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set # updated to the new default, unless the user explicitly changed it. endif() if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" - AND NOT CMAKE_CROSSCOMPILING) + AND NOT CMAKE_CROSSCOMPILING + AND NOT EXISTS "/etc/arch-release") if (EXISTS "/etc/debian_version") # is this a debian system ? if(CMAKE_LIBRARY_ARCHITECTURE) if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 2beea00..57ae446 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -729,7 +729,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa if(gp_tool MATCHES "ldd$") set(gp_cmd_args "") - set(gp_regex "^[\t ]*[^\t ]+ => ([^\t\(]+) .*${eol_char}$") + set(gp_regex "^[\t ]*[^\t ]+ =>[\t ]+([^\t\(]+)( \(.+\))?${eol_char}$") set(gp_regex_error "not found${eol_char}$") set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$") set(gp_regex_cmp_count 1) diff --git a/Modules/Internal/CPack/CPack.STGZ_Header.sh.in b/Modules/Internal/CPack/CPack.STGZ_Header.sh.in index 003fcfe..a857aa5 100755 --- a/Modules/Internal/CPack/CPack.STGZ_Header.sh.in +++ b/Modules/Internal/CPack/CPack.STGZ_Header.sh.in @@ -86,15 +86,19 @@ then @CPACK_RESOURCE_FILE_LICENSE_CONTENT@ ____cpack__here_doc____ echo - echo "Do you accept the license? [yN]: " - read line leftover - case ${line} in - y* | Y*) - cpack_license_accepted=TRUE;; - *) - echo "License not accepted. Exiting ..." - exit 1;; - esac + while true + do + echo "Do you accept the license? [yn]: " + read line leftover + case ${line} in + y* | Y*) + cpack_license_accepted=TRUE + break;; + n* | N* | q* | Q* | e* | E*) + echo "License not accepted. Exiting ..." + exit 1;; + esac + done fi if [ "x${cpack_include_subdir}x" = "xx" ] diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index 728e0b9..220649c 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -8,6 +8,9 @@ if(__WINDOWS_CLANG) endif() set(__WINDOWS_CLANG 1) +set(__pch_header_C "c-header") +set(__pch_header_CXX "c++-header") + macro(__windows_compiler_clang_gnu lang) set(CMAKE_LIBRARY_PATH_FLAG "-L") set(CMAKE_LINK_LIBRARY_FLAG "-l") @@ -73,6 +76,10 @@ macro(__windows_compiler_clang_gnu lang) string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG -Xclang -gcodeview ${__ADDED_FLAGS}") set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ") + set(CMAKE_PCH_EXTENSION .gch) + set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Winvalid-pch -include <PCH_HEADER>) + set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Winvalid-pch -x ${__pch_header_${lang}} -include <PCH_HEADER>) + unset(__ADDED_FLAGS) unset(__ADDED_FLAGS_DEBUG) string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_LOWER) diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 48b936e..370b56e 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -119,6 +119,13 @@ macro(__embarcadero_language lang) "tlib ${CMAKE_START_TEMP_FILE}/p512 <LINK_FLAGS> /a <TARGET_QUOTED> <OBJECTS>${CMAKE_END_TEMP_FILE}" ) + # Precompile Headers + if (EMBARCADERO) + set(CMAKE_PCH_EXTENSION .pch) + set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang <PCH_FILE>) + set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang -include -Xclang <PCH_HEADER>) + endif() + # Initial configuration flags. string(APPEND CMAKE_${lang}_FLAGS_INIT " ${_tM}") string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -Od -v") diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 7a83859..6ddcaa3 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -329,6 +329,15 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_LINK_EXECUTABLE "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") + set(CMAKE_PCH_EXTENSION .pch) + set(CMAKE_LINK_PCH ON) + if(MSVC_VERSION GREATER_EQUAL 1910) + # VS 2017 or greater + set(CMAKE_PCH_PROLOGUE "#pragma system_header") + endif() + set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH /Yu<PCH_HEADER> /FI<PCH_HEADER>) + set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH /Yc<PCH_HEADER> /FI<PCH_HEADER>) + if("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC") set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES) set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) |