diff options
Diffstat (limited to 'Modules')
97 files changed, 1311 insertions, 516 deletions
diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake index 97cb488..27b93ec 100644 --- a/Modules/CMakeASM_NASMInformation.cmake +++ b/Modules/CMakeASM_NASMInformation.cmake @@ -38,6 +38,15 @@ if(NOT CMAKE_ASM_NASM_COMPILE_OBJECT) set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> <INCLUDES> <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>") endif() +set(CMAKE_DEPFILE_FLAGS_ASM_NASM "-MD <DEP_FILE> -MT <DEP_TARGET>") + +if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) + AND CMAKE_GENERATOR MATCHES "Makefiles|WMake") + # dependencies are computed by the compiler itself + set(CMAKE_ASM_NASM_DEPFILE_FORMAT gcc) + set(CMAKE_ASM_NASM_DEPENDS_USE_COMPILER TRUE) +endif() + # Load the generic ASMInformation file: set(ASM_DIALECT "_NASM") include(CMakeASMInformation) diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index 7f73891..754f235 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -9,6 +9,8 @@ set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@") set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@") set(CMAKE_C99_COMPILE_FEATURES "@CMAKE_C99_COMPILE_FEATURES@") set(CMAKE_C11_COMPILE_FEATURES "@CMAKE_C11_COMPILE_FEATURES@") +set(CMAKE_C17_COMPILE_FEATURES "@CMAKE_C17_COMPILE_FEATURES@") +set(CMAKE_C23_COMPILE_FEATURES "@CMAKE_C23_COMPILE_FEATURES@") set(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@") set(CMAKE_C_SIMULATE_ID "@CMAKE_C_SIMULATE_ID@") diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 14e1282..75e9d1a 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -33,13 +33,16 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@ @CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@ -#if !defined(__STDC__) -# if (defined(_MSC_VER) && !defined(__clang__)) \ - || (defined(__ibmxl__) || defined(__IBMC__)) +#if !defined(__STDC__) && !defined(__clang__) +# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) # define C_DIALECT "90" # else # define C_DIALECT # endif +#elif __STDC_VERSION__ > 201710L +# define C_DIALECT "23" +#elif __STDC_VERSION__ >= 201710L +# define C_DIALECT "17" #elif __STDC_VERSION__ >= 201000L # define C_DIALECT "11" #elif __STDC_VERSION__ >= 199901L diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake index 5fd54c1..541d207 100644 --- a/Modules/CMakeCUDAInformation.cmake +++ b/Modules/CMakeCUDAInformation.cmake @@ -9,15 +9,15 @@ endif() set(CMAKE_INCLUDE_FLAG_CUDA "-I") # Set implicit links early so compiler-specific modules can use them. -set(__IMPLICT_LINKS ) +set(__IMPLICIT_LINKS) foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}) - string(APPEND __IMPLICT_LINKS " -L\"${dir}\"") + string(APPEND __IMPLICIT_LINKS " -L\"${dir}\"") endforeach() foreach(lib ${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES}) if(${lib} MATCHES "/") - string(APPEND __IMPLICT_LINKS " \"${lib}\"") + string(APPEND __IMPLICIT_LINKS " \"${lib}\"") else() - string(APPEND __IMPLICT_LINKS " -l${lib}") + string(APPEND __IMPLICIT_LINKS " -l${lib}") endif() endforeach() @@ -110,17 +110,10 @@ include(CMakeCommonLanguageInclude) # CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION # CMAKE_CUDA_LINK_EXECUTABLE -if(CMAKE_CUDA_HOST_COMPILER AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") - # FIXME: This is too late for the Platform/Windows-NVIDIA-CUDA module to - # see it, so we do not support CMAKE_CUDA_HOST_COMPILER on Windows. - # Move this to Compiler/NVIDIA-CUDA and update the VS generator too. - string(APPEND _CMAKE_CUDA_EXTRA_FLAGS " -ccbin=<CMAKE_CUDA_HOST_COMPILER>") -endif() - # create a shared library if(NOT CMAKE_CUDA_CREATE_SHARED_LIBRARY) set(CMAKE_CUDA_CREATE_SHARED_LIBRARY - "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}") + "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICIT_LINKS}") endif() # create a shared module copy the shared library rule by default @@ -160,32 +153,32 @@ endif() # compile a cu file into an executable if(NOT CMAKE_CUDA_LINK_EXECUTABLE) set(CMAKE_CUDA_LINK_EXECUTABLE - "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_LINKS}") + "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICIT_LINKS}") endif() # Add implicit host link directories that contain device libraries # to the device link line. -set(__IMPLICT_DLINK_DIRS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) -if(__IMPLICT_DLINK_DIRS) - list(REMOVE_ITEM __IMPLICT_DLINK_DIRS ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}) +set(__IMPLICIT_DLINK_DIRS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) +if(__IMPLICIT_DLINK_DIRS) + list(REMOVE_ITEM __IMPLICIT_DLINK_DIRS ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}) endif() -set(__IMPLICT_DLINK_FLAGS ) -foreach(dir ${__IMPLICT_DLINK_DIRS}) +set(__IMPLICIT_DLINK_FLAGS) +foreach(dir ${__IMPLICIT_DLINK_DIRS}) if(EXISTS "${dir}/libcurand_static.a") - string(APPEND __IMPLICT_DLINK_FLAGS " -L\"${dir}\"") + string(APPEND __IMPLICIT_DLINK_FLAGS " -L\"${dir}\"") endif() endforeach() -unset(__IMPLICT_DLINK_DIRS) +unset(__IMPLICIT_DLINK_DIRS) #These are used when linking relocatable (dc) cuda code if(NOT CMAKE_CUDA_DEVICE_LINK_LIBRARY) set(CMAKE_CUDA_DEVICE_LINK_LIBRARY - "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_DLINK_FLAGS}") + "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICIT_DLINK_FLAGS}") endif() if(NOT CMAKE_CUDA_DEVICE_LINK_EXECUTABLE) set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE - "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_DLINK_FLAGS}") + "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICIT_DLINK_FLAGS}") endif() # Used when device linking is handled by CMake. @@ -193,6 +186,6 @@ if(NOT CMAKE_CUDA_DEVICE_LINK_COMPILE) set(CMAKE_CUDA_DEVICE_LINK_COMPILE "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <FLAGS> -D__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__ -D__NV_EXTRA_INITIALIZATION=\"\" -D__NV_EXTRA_FINALIZATION=\"\" -DREGISTERLINKBINARYFILE=\\\"<REGISTER_FILE>\\\" -DFATBINFILE=\\\"<FATBINARY>\\\" ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c \"${CMAKE_CUDA_COMPILER_TOOLKIT_LIBRARY_ROOT}/bin/crt/link.stub\" -o <OBJECT>") endif() -unset(__IMPLICT_DLINK_FLAGS) +unset(__IMPLICIT_DLINK_FLAGS) set(CMAKE_CUDA_INFORMATION_LOADED 1) diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 45acfe7..d0ce77a 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -44,7 +44,7 @@ if(CMAKE_COMPILER_IS_MINGW) set(MINGW 1) endif() set(CMAKE_CXX_COMPILER_ID_RUN 1) -set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm) set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) foreach (lang C OBJC OBJCXX) diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake index 2dc75d6..05174de 100644 --- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake +++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake @@ -8,7 +8,7 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR) set(${_VAR} - FAIL_REGEX "[Uu]nrecogni[sz]ed .*option" # GNU, NAG + FAIL_REGEX "[Uu]nrecogni[sz]ed .*option" # GNU, NAG, Fujitsu FAIL_REGEX "switch .* is no longer supported" # GNU FAIL_REGEX "unknown .*option" # Clang FAIL_REGEX "optimization flag .* not supported" # Clang diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index 214d58a..850fc14 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -18,7 +18,7 @@ function(compiler_id_detection outvar lang) file(GLOB lang_files "${CMAKE_ROOT}/Modules/Compiler/*-DetermineCompiler.cmake") set(nonlang CXX) - if (lang STREQUAL CXX) + if ("x${lang}" STREQUAL "xCXX") set(nonlang C) endif() @@ -66,6 +66,7 @@ function(compiler_id_detection outvar lang) PGI Cray TI + FujitsuClang Fujitsu GHS ) diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake index e7de9cc..e360d31 100644 --- a/Modules/CMakeDetermineCUDACompiler.cmake +++ b/Modules/CMakeDetermineCUDACompiler.cmake @@ -11,6 +11,9 @@ if( NOT ( ("${CMAKE_GENERATOR}" MATCHES "Make") OR endif() if(${CMAKE_GENERATOR} MATCHES "Visual Studio") + if(DEFINED ENV{CUDAHOSTCXX} OR DEFINED CMAKE_CUDA_HOST_COMPILER) + message(WARNING "Visual Studio does not support specifying CUDAHOSTCXX or CMAKE_CUDA_HOST_COMPILER. Using the C++ compiler provided by Visual Studio.") + endif() else() if(NOT CMAKE_CUDA_COMPILER) set(CMAKE_CUDA_COMPILER_INIT NOTFOUND) @@ -31,19 +34,21 @@ else() set(CMAKE_CUDA_COMPILER_LIST nvcc) endif() + set(_CMAKE_CUDA_COMPILER_PATHS "$ENV{CUDA_PATH}/bin") _cmake_find_compiler(CUDA) + unset(_CMAKE_CUDA_COMPILER_PATHS) else() _cmake_find_compiler_path(CUDA) endif() mark_as_advanced(CMAKE_CUDA_COMPILER) -endif() -#Allow the user to specify a host compiler -if(NOT $ENV{CUDAHOSTCXX} STREQUAL "") - get_filename_component(CMAKE_CUDA_HOST_COMPILER $ENV{CUDAHOSTCXX} PROGRAM) - if(NOT EXISTS ${CMAKE_CUDA_HOST_COMPILER}) - message(FATAL_ERROR "Could not find compiler set in environment variable CUDAHOSTCXX:\n$ENV{CUDAHOSTCXX}.\n${CMAKE_CUDA_HOST_COMPILER}") + #Allow the user to specify a host compiler except for Visual Studio + if(NOT $ENV{CUDAHOSTCXX} STREQUAL "") + get_filename_component(CMAKE_CUDA_HOST_COMPILER $ENV{CUDAHOSTCXX} PROGRAM) + if(NOT EXISTS ${CMAKE_CUDA_HOST_COMPILER}) + message(FATAL_ERROR "Could not find compiler set in environment variable CUDAHOSTCXX:\n$ENV{CUDAHOSTCXX}.\n${CMAKE_CUDA_HOST_COMPILER}") + endif() endif() endif() diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompileFeatures.cmake index c03a85f..ee7fedb 100644 --- a/Modules/CMakeDetermineCompileFeatures.cmake +++ b/Modules/CMakeDetermineCompileFeatures.cmake @@ -4,12 +4,14 @@ function(cmake_determine_compile_features lang) - if(lang STREQUAL C AND COMMAND cmake_record_c_compile_features) + if("x${lang}" STREQUAL "xC" AND COMMAND cmake_record_c_compile_features) message(CHECK_START "Detecting ${lang} compile features") set(CMAKE_C90_COMPILE_FEATURES) set(CMAKE_C99_COMPILE_FEATURES) set(CMAKE_C11_COMPILE_FEATURES) + set(CMAKE_C17_COMPILE_FEATURES) + set(CMAKE_C23_COMPILE_FEATURES) include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake") @@ -20,6 +22,12 @@ function(cmake_determine_compile_features lang) return() endif() + if (CMAKE_C17_COMPILE_FEATURES AND CMAKE_C23_COMPILE_FEATURES) + list(REMOVE_ITEM CMAKE_C23_COMPILE_FEATURES ${CMAKE_C17_COMPILE_FEATURES}) + endif() + if (CMAKE_C11_COMPILE_FEATURES AND CMAKE_C17_COMPILE_FEATURES) + list(REMOVE_ITEM CMAKE_C17_COMPILE_FEATURES ${CMAKE_C11_COMPILE_FEATURES}) + endif() if (CMAKE_C99_COMPILE_FEATURES AND CMAKE_C11_COMPILE_FEATURES) list(REMOVE_ITEM CMAKE_C11_COMPILE_FEATURES ${CMAKE_C99_COMPILE_FEATURES}) endif() @@ -32,6 +40,8 @@ function(cmake_determine_compile_features lang) ${CMAKE_C90_COMPILE_FEATURES} ${CMAKE_C99_COMPILE_FEATURES} ${CMAKE_C11_COMPILE_FEATURES} + ${CMAKE_C17_COMPILE_FEATURES} + ${CMAKE_C23_COMPILE_FEATURES} ) endif() @@ -39,10 +49,12 @@ function(cmake_determine_compile_features lang) set(CMAKE_C90_COMPILE_FEATURES ${CMAKE_C90_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_C99_COMPILE_FEATURES ${CMAKE_C99_COMPILE_FEATURES} PARENT_SCOPE) set(CMAKE_C11_COMPILE_FEATURES ${CMAKE_C11_COMPILE_FEATURES} PARENT_SCOPE) + set(CMAKE_C17_COMPILE_FEATURES ${CMAKE_C17_COMPILE_FEATURES} PARENT_SCOPE) + set(CMAKE_C23_COMPILE_FEATURES ${CMAKE_C23_COMPILE_FEATURES} PARENT_SCOPE) message(CHECK_PASS "done") - elseif(lang STREQUAL CXX AND COMMAND cmake_record_cxx_compile_features) + elseif("x${lang}" STREQUAL "xCXX" AND COMMAND cmake_record_cxx_compile_features) message(CHECK_START "Detecting ${lang} compile features") set(CMAKE_CXX98_COMPILE_FEATURES) @@ -98,7 +110,7 @@ function(cmake_determine_compile_features lang) message(CHECK_PASS "done") - elseif(lang STREQUAL CUDA AND COMMAND cmake_record_cuda_compile_features) + elseif("x${lang}" STREQUAL "xCUDA" AND COMMAND cmake_record_cuda_compile_features) message(CHECK_START "Detecting ${lang} compile features") set(CMAKE_CUDA03_COMPILE_FEATURES) diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake index 2780399..6430793 100644 --- a/Modules/CMakeDetermineCompiler.cmake +++ b/Modules/CMakeDetermineCompiler.cmake @@ -68,6 +68,16 @@ macro(_cmake_find_compiler lang) ) endif() find_program(CMAKE_${lang}_COMPILER NAMES ${CMAKE_${lang}_COMPILER_LIST} DOC "${lang} compiler") + if(_CMAKE_${lang}_COMPILER_PATHS) + # As a last fall-back, search in language-specific paths + find_program(CMAKE_${lang}_COMPILER + NAMES ${CMAKE_${lang}_COMPILER_LIST} + NAMES_PER_DIR + PATHS ${_CMAKE_${lang}_COMPILER_PATHS} + DOC "${lang} compiler" + NO_DEFAULT_PATH + ) + endif() if(CMAKE_${lang}_COMPILER_INIT AND NOT CMAKE_${lang}_COMPILER) set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${CMAKE_${lang}_COMPILER_INIT}") endif() diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index ad9503c..448f071 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -166,6 +166,25 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) endif() endif() + # The Fujitsu compiler does not always convey version information through + # preprocessor symbols so we extract through command line info + if (CMAKE_${lang}_COMPILER_ID STREQUAL "Fujitsu") + if(NOT CMAKE_${lang}_COMPILER_VERSION) + execute_process( + COMMAND "${CMAKE_${lang}_COMPILER}" -V + OUTPUT_VARIABLE output + ERROR_VARIABLE output + RESULT_VARIABLE result + TIMEOUT 10 + ) + if (result EQUAL 0) + if (output MATCHES [[Fujitsu [^ ]* Compiler ([0-9]+\.[0-9]+\.[0-9]+)]]) + set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_MATCH_1}") + endif() + endif() + endif() + endif() + # if the format is unknown after all files have been checked, put "Unknown" in the cache if(NOT CMAKE_EXECUTABLE_FORMAT) set(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format") @@ -204,6 +223,8 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) else() set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "GNU") endif() + elseif("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xFujitsuClang") + set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "GNU") else() set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "") endif() @@ -299,7 +320,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_cl "$(CLToolExe)") elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") set(id_cl clang.exe) - # Executable names have choosen according documentation + # Executable names have been chosen according documentation # URL: (https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-dpcpp-compiler/top.html#top_GUID-A9B4C91D-97AC-450D-9742-9D895BC8AEE1) elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel") if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "DPC\\+\\+ Compiler") @@ -453,9 +474,19 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_ItemDefinitionGroup_entry "<CudaCompile>${cuda_target}<AdditionalOptions>%(AdditionalOptions)-v</AdditionalOptions><CodeGeneration>${cuda_codegen}</CodeGeneration></CudaCompile>") set(id_PostBuildEvent_Command [[echo CMAKE_CUDA_COMPILER=$(CudaToolkitBinDir)\nvcc.exe]]) if(CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR) - set(id_CudaToolkitCustomDir "<CudaToolkitCustomDir>${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}nvcc</CudaToolkitCustomDir>") - string(CONCAT id_Import_props "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}\\CUDAVisualStudioIntegration\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.props\" />") - string(CONCAT id_Import_targets "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}\\CUDAVisualStudioIntegration\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.targets\" />") + # check for legacy cuda custom toolkit folder structure + if(EXISTS ${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}nvcc) + set(id_CudaToolkitCustomDir "<CudaToolkitCustomDir>${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}nvcc</CudaToolkitCustomDir>") + else() + set(id_CudaToolkitCustomDir "<CudaToolkitCustomDir>${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}</CudaToolkitCustomDir>") + endif() + if(EXISTS ${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}CUDAVisualStudioIntegration) + string(CONCAT id_Import_props "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}CUDAVisualStudioIntegration\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.props\" />") + string(CONCAT id_Import_targets "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}CUDAVisualStudioIntegration\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.targets\" />") + else() + string(CONCAT id_Import_props "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.props\" />") + string(CONCAT id_Import_targets "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.targets\" />") + endif() else() string(CONCAT id_Import_props [[<Import Project="$(VCTargetsPath)\BuildCustomizations\]] "${cuda_tools}" [[.props" />]]) string(CONCAT id_Import_targets [[<Import Project="$(VCTargetsPath)\BuildCustomizations\]] "${cuda_tools}" [[.targets" />]]) @@ -821,8 +852,10 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}") endif() if("${info}" MATCHES "INFO:compiler_version_internal\\[([^]\"]*)\\]") - string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION_INTERNAL "${CMAKE_MATCH_1}") - string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION_INTERNAL "${COMPILER_VERSION_INTERNAL}") + set(COMPILER_VERSION_INTERNAL "${CMAKE_MATCH_1}") + string(REGEX REPLACE "^0+([0-9]+)" "\\1" COMPILER_VERSION_INTERNAL "${COMPILER_VERSION_INTERNAL}") + string(REGEX REPLACE "\\.0+([0-9]+)" ".\\1" COMPILER_VERSION_INTERNAL "${COMPILER_VERSION_INTERNAL}") + string(STRIP "${COMPILER_VERSION_INTERNAL}" COMPILER_VERSION_INTERNAL) endif() foreach(comp MAJOR MINOR PATCH TWEAK) foreach(digit 1 2 3 4 5 6 7 8 9) diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index bae270d..8c7af06 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -27,6 +27,7 @@ # Tru64 Tru64 # Ultrix ULTRIX # cygwin CYGWIN_NT-5.1 +# MSYS MSYS_NT-6.1 # MacOSX Darwin @@ -43,7 +44,7 @@ if(CMAKE_HOST_UNIX) else() exec_program(${CMAKE_UNAME} ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION) endif() - if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|^GNU$|Android") + if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|MSYS.*|^GNU$|Android") exec_program(${CMAKE_UNAME} ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR RETURN_VALUE val) elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin") @@ -158,37 +159,14 @@ endif() include(Platform/${CMAKE_SYSTEM_NAME}-Determine OPTIONAL) -macro(ADJUST_CMAKE_SYSTEM_VARIABLES _PREFIX) - if(NOT ${_PREFIX}_NAME) - set(${_PREFIX}_NAME "UnknownOS") - endif() - - # fix for BSD/OS , remove the / - if(${_PREFIX}_NAME MATCHES BSD.OS) - set(${_PREFIX}_NAME BSDOS) - endif() - - # fix for GNU/kFreeBSD, remove the GNU/ - if(${_PREFIX}_NAME MATCHES kFreeBSD) - set(${_PREFIX}_NAME kFreeBSD) - endif() - - # fix for CYGWIN which has windows version in it - if(${_PREFIX}_NAME MATCHES CYGWIN) - set(${_PREFIX}_NAME CYGWIN) - endif() - - # set CMAKE_SYSTEM to the CMAKE_SYSTEM_NAME - set(${_PREFIX} ${${_PREFIX}_NAME}) - # if there is a CMAKE_SYSTEM_VERSION then add a -${CMAKE_SYSTEM_VERSION} - if(${_PREFIX}_VERSION) - set(${_PREFIX} ${${_PREFIX}}-${${_PREFIX}_VERSION}) - endif() - -endmacro() - -ADJUST_CMAKE_SYSTEM_VARIABLES(CMAKE_SYSTEM) -ADJUST_CMAKE_SYSTEM_VARIABLES(CMAKE_HOST_SYSTEM) +set(CMAKE_SYSTEM ${CMAKE_SYSTEM_NAME}) +if(CMAKE_SYSTEM_VERSION) + string(APPEND CMAKE_SYSTEM -${CMAKE_SYSTEM_VERSION}) +endif() +set(CMAKE_HOST_SYSTEM ${CMAKE_HOST_SYSTEM_NAME}) +if(CMAKE_HOST_SYSTEM_VERSION) + string(APPEND CMAKE_HOST_SYSTEM -${CMAKE_HOST_SYSTEM_VERSION}) +endif() # this file is also executed from cpack, then we don't need to generate these files # in this case there is no CMAKE_BINARY_DIR diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 7aa385e..d0e0e46 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -26,7 +26,7 @@ PRINT *, 'INFO:compiler[IntelLLVM]' ! __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and ! later. Look for 6 digit vs. 8 digit version number to decide encoding. -! VVVV is no smaller than the current year when a versio is released. +! VVVV is no smaller than the current year when a version is released. # if __INTEL_LLVM_COMPILER < 1000000 # define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) # define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) @@ -156,6 +156,15 @@ #define COMPILER_VERSION_MAJOR DEC(__NAG_COMPILER_RELEASE/10) #define COMPILER_VERSION_MINOR DEC(__NAG_COMPILER_RELEASE % 10) #define COMPILER_VERSION_PATCH DEC(__NAG_COMPILER_BUILD) +#elif defined(__FUJITSU) + PRINT *, 'INFO:compiler[Fujitsu]' +# if defined(__FRT_major__) +# define COMPILER_VERSION_MAJOR DEC(__FRT_major__) +# define COMPILER_VERSION_MINOR DEC(__FRT_minor__) +# define COMPILER_VERSION_PATCH DEC(__FRT_patchlevel__) +# elif defined(__FRT_version__) + PRINT *, 'INFO:compiler_version['//__FRT_version__//']' +# endif #else PRINT *, 'INFO:compiler[]' #endif diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index ad719ef..5813956 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -143,12 +143,12 @@ The ``COMPATIBILITY`` mode ``AnyNewerVersion`` means that the installed package version will be considered compatible if it is newer or exactly the same as the requested version. This mode should be used for packages which are fully backward compatible, also across major versions. -If ``SameMajorVersion`` is used instead, then the behaviour differs from +If ``SameMajorVersion`` is used instead, then the behavior differs from ``AnyNewerVersion`` in that the major version number must be the same as requested, e.g. version 2.0 will not be considered compatible if 1.0 is requested. This mode should be used for packages which guarantee backward compatibility within the same major version. -If ``SameMinorVersion`` is used, the behaviour is the same as +If ``SameMinorVersion`` is used, the behavior is the same as ``SameMajorVersion``, but both major and minor version must be the same as requested, e.g version 0.2 will not be compatible if 0.1 is requested. If ``ExactVersion`` is used, then the package is only considered compatible if diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake index 7cd7548..a8e6ac0 100644 --- a/Modules/CMakeParseImplicitIncludeInfo.cmake +++ b/Modules/CMakeParseImplicitIncludeInfo.cmake @@ -146,6 +146,21 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) endif() endif() + # Fujitsu compiler + if(CMAKE_${lang}_COMPILER_ID STREQUAL "Fujitsu" AND + line MATCHES "/ccpcom") + string(REGEX MATCHALL " (-I *|--sys_include=|--preinclude +)(\"[^\"]+\"|[^ \"]+)" incs "${line}") + foreach(inc IN LISTS incs) + string(REGEX REPLACE " (-I *|--sys_include=|--preinclude +)(\"[^\"]+\"|[^ \"]+)" "\\2" idir "${inc}") + list(APPEND rv "${idir}") + endforeach() + if(rv) + string(APPEND log " got implicit includes via fujitsu ccpcom parser!\n") + else() + string(APPEND log " warning: fujitsu ccpcom parse failed!\n") + endif() + endif() + if(log) set(${log_var} "${log}" PARENT_SCOPE) else() diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index 1dc12c0..59195f8 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -5,6 +5,9 @@ #if defined(__linux) || defined(__linux__) || defined(linux) # define PLATFORM_ID "Linux" +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + #elif defined(__CYGWIN__) # define PLATFORM_ID "Cygwin" @@ -256,8 +259,12 @@ ('0' + ((n)>>4 & 0xF)), \ ('0' + ((n) & 0xF)) +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + /* Construct a string literal encoding the version number components. */ -#ifdef COMPILER_VERSION_MAJOR +#elif defined(COMPILER_VERSION_MAJOR) char const info_version[] = { 'I', 'N', 'F', 'O', ':', 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', @@ -281,6 +288,8 @@ char const info_version_internal[] = { 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', 'i','n','t','e','r','n','a','l','[', COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; #endif /* Construct a string literal encoding the version number components. */ diff --git a/Modules/CMakePrintHelpers.cmake b/Modules/CMakePrintHelpers.cmake index d652ffa..8c25a73 100644 --- a/Modules/CMakePrintHelpers.cmake +++ b/Modules/CMakePrintHelpers.cmake @@ -101,7 +101,10 @@ function(cmake_print_properties) if(CPP_CACHE_ENTRIES) set(items ${CPP_CACHE_ENTRIES}) set(mode ${mode} CACHE_ENTRIES) - set(keyword CACHE) + # This is a workaround for the fact that passing `CACHE` as an argument to + # set() causes a cache variable to be set. + set(keyword "") + string(APPEND keyword CACHE) endif() if(NOT mode) diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index ea3a445..0ded568 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -14,6 +14,7 @@ set(APPLE ) set(UNIX ) set(CYGWIN ) +set(MSYS ) set(WIN32 ) diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index ef5a7d5..373a707 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -291,18 +291,27 @@ installers. The most commonly-used variables are: Some compression methods used by CPack generators such as Debian or Archive may take advantage of multiple CPU cores to speed up compression. - ``CPACK_THREADS`` can be set to positive integer to specify how many threads - will be used for compression. If it is set to 0, CPack will set it so that - all available CPU cores are used. + ``CPACK_THREADS`` can be set to specify how many threads will be + used for compression. + + A positive integer can be used to specify an exact desired thread count. + + When given a negative integer CPack will use the absolute value + as the upper limit but may choose a lower value based on + the available hardware concurrency. + + Given 0 CPack will try to use all available CPU cores. + By default ``CPACK_THREADS`` is set to ``1``. - Currently only ``xz`` compression *may* take advantage of multiple cores. Other - compression methods ignore this value and use only one thread. + Currently only ``xz`` compression *may* take advantage of multiple cores. + Other compression methods ignore this value and use only one thread. - .. note:: + .. versionadded:: 3.21 - Official CMake binaries available on ``cmake.org`` ship with a ``liblzma`` - that does not support parallel compression. + Official CMake binaries available on ``cmake.org`` now ship + with a ``liblzma`` that supports parallel compression. + Older versions did not. Variables for Source Package Generators ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index d57cf18..2087a51 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -125,6 +125,11 @@ The module defines the following commands: list of dependency component or component group identifiers in QtIFW style. + .. versionadded:: 3.21 + + Component or group names listed as dependencies may contain hyphens. + This requires QtIFW 3.1 or later. + ``AUTO_DEPEND_ON`` .. versionadded:: 3.8 @@ -260,6 +265,11 @@ The module defines the following commands: list of dependency component or component group identifiers in QtIFW style. + .. versionadded:: 3.21 + + Component or group names listed as dependencies may contain hyphens. + This requires QtIFW 3.1 or later. + ``AUTO_DEPEND_ON`` .. versionadded:: 3.8 diff --git a/Modules/Compiler/ARMClang.cmake b/Modules/Compiler/ARMClang.cmake index da7a43c..354c11d 100644 --- a/Modules/Compiler/ARMClang.cmake +++ b/Modules/Compiler/ARMClang.cmake @@ -3,6 +3,9 @@ if(_ARMClang_CMAKE_LOADED) endif() set(_ARMClang_CMAKE_LOADED TRUE) +# Save the CMP0123 setting in a variable used both below and by try_compile. +cmake_policy(GET CMP0123 CMAKE_ARMClang_CMP0123) + cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) # if IN_LIST @@ -82,36 +85,53 @@ macro(__compiler_armclang lang) if(NOT CMAKE_${lang}_COMPILER_ARCH_LIST) __armclang_set_arch_list(${lang} CMAKE_${lang}_COMPILER_ARCH_LIST) endif() - if(NOT CMAKE_SYSTEM_PROCESSOR AND NOT CMAKE_SYSTEM_ARCH) - message(FATAL_ERROR " CMAKE_SYSTEM_PROCESSOR or CMAKE_SYSTEM_ARCH must be set for ARMClang\n" - " Supported processor: ${CMAKE_${lang}_COMPILER_PROCESSOR_LIST}\n" - " Supported Architecture: ${CMAKE_${lang}_COMPILER_ARCH_LIST}") - else() - __armclang_check_processor("${CMAKE_SYSTEM_ARCH}" "${CMAKE_${lang}_COMPILER_ARCH_LIST}" _CMAKE_${lang}_CHECK_ARCH_RESULT) - if( _CMAKE_${lang}_CHECK_ARCH_RESULT) - string(APPEND CMAKE_${lang}_FLAGS_INIT "-march=${CMAKE_SYSTEM_ARCH}") - set(__march_flag_set TRUE) + + # CMAKE_SYSTEM_PROCESSOR and CMAKE_SYSTEM_ARCH are not sufficient because they provide no + # information of additional CPU features needed in `-mcpu=<name>[+[no]<feature>+...]`. + # The automatic setting of compile and link options is deprecated and projects should specify their own. + cmake_policy(GET CMP0123 policy_CMP0123) + if(NOT "x${CMAKE_ARMClang_CMP0123}x" STREQUAL "xNEWx") + if(NOT "x${CMAKE_ARMClang_CMP0123}x" STREQUAL "xOLDx") + cmake_policy(GET_WARNING CMP0123 _cmp0123_warning) + message(AUTHOR_WARNING + "${_cmp0123_warning}\n" + "For compatibility, CMake will automatically add cpu/arch flags based " + "on the CMAKE_SYSTEM_PROCESSOR and/or CMAKE_SYSTEM_ARCH variables." + ) endif() - __armclang_check_processor("${CMAKE_SYSTEM_PROCESSOR}" "${CMAKE_${lang}_COMPILER_PROCESSOR_LIST}" _CMAKE_${lang}_CHECK_PROCESSOR_RESULT) - if(_CMAKE_${lang}_CHECK_PROCESSOR_RESULT) - string(APPEND CMAKE_${lang}_FLAGS_INIT "-mcpu=${CMAKE_SYSTEM_PROCESSOR}") - set(__mcpu_flag_set TRUE) + + if(NOT CMAKE_SYSTEM_PROCESSOR AND NOT CMAKE_SYSTEM_ARCH) + message(FATAL_ERROR " CMAKE_SYSTEM_PROCESSOR or CMAKE_SYSTEM_ARCH must be set for ARMClang\n" + " Supported processor: ${CMAKE_${lang}_COMPILER_PROCESSOR_LIST}\n" + " Supported Architecture: ${CMAKE_${lang}_COMPILER_ARCH_LIST}") + else() + __armclang_check_processor("${CMAKE_SYSTEM_ARCH}" "${CMAKE_${lang}_COMPILER_ARCH_LIST}" _CMAKE_${lang}_CHECK_ARCH_RESULT) + if( _CMAKE_${lang}_CHECK_ARCH_RESULT) + string(APPEND CMAKE_${lang}_FLAGS_INIT " -march=${CMAKE_SYSTEM_ARCH}") + set(__march_flag_set TRUE) + endif() + __armclang_check_processor("${CMAKE_SYSTEM_PROCESSOR}" "${CMAKE_${lang}_COMPILER_PROCESSOR_LIST}" _CMAKE_${lang}_CHECK_PROCESSOR_RESULT) + if(_CMAKE_${lang}_CHECK_PROCESSOR_RESULT) + string(APPEND CMAKE_${lang}_FLAGS_INIT " -mcpu=${CMAKE_SYSTEM_PROCESSOR}") + set(__mcpu_flag_set TRUE) + endif() + if(NOT __march_flag_set AND NOT __mcpu_flag_set) + message(FATAL_ERROR "At least one of the variables CMAKE_SYSTEM_PROCESSOR or CMAKE_SYSTEM_ARCH must be set for ARMClang\n" + "Supported processor: ${CMAKE_${lang}_COMPILER_PROCESSOR_LIST}\n" + " Supported Architecture: ${CMAKE_${lang}_COMPILER_ARCH_LIST}") + endif() + unset(_CMAKE_${lang}_CHECK_PROCESSOR_RESULT) + unset(_CMAKE_${lang}_CHECK_ARCH_RESULT) endif() - if(NOT __march_flag_set AND NOT __mcpu_flag_set) - message(FATAL_ERROR "At least one of the variables CMAKE_SYSTEM_PROCESSOR or CMAKE_SYSTEM_ARCH must be set for ARMClang\n" - "Supported processor: ${CMAKE_${lang}_COMPILER_PROCESSOR_LIST}\n" - " Supported Architecture: ${CMAKE_${lang}_COMPILER_ARCH_LIST}") + + #check if CMAKE_SYSTEM_PROCESSOR belongs to supported cpu list for armlink + __armlink_set_cpu_list( ${lang} CMAKE_LINKER_CPU_LIST) + list(TRANSFORM CMAKE_LINKER_CPU_LIST TOLOWER) + __armclang_check_processor("${CMAKE_SYSTEM_PROCESSOR}" "${CMAKE_LINKER_CPU_LIST}" _CMAKE_CHECK_LINK_CPU_RESULT) + if(_CMAKE_CHECK_LINK_CPU_RESULT) + string(APPEND CMAKE_${lang}_LINK_FLAGS " --cpu=${CMAKE_SYSTEM_PROCESSOR}") endif() - unset(_CMAKE_${lang}_CHECK_PROCESSOR_RESULT) - unset(_CMAKE_${lang}_CHECK_ARCH_RESULT) - endif() - #check if CMAKE_SYSTEM_PROCESSOR belongs to supported cpu list for armlink - __armlink_set_cpu_list( ${lang} CMAKE_LINKER_CPU_LIST) - list(TRANSFORM CMAKE_LINKER_CPU_LIST TOLOWER) - __armclang_check_processor("${CMAKE_SYSTEM_PROCESSOR}" "${CMAKE_LINKER_CPU_LIST}" _CMAKE_CHECK_LINK_CPU_RESULT) - if(_CMAKE_CHECK_LINK_CPU_RESULT) - string(APPEND CMAKE_${lang}_LINK_FLAGS "--cpu=${CMAKE_SYSTEM_PROCESSOR}") endif() if(__CMAKE_ARMClang_USING_armlink) diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake index cd897c5..29e6730 100644 --- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake +++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake @@ -64,6 +64,12 @@ endmacro() # Define to allow compile features to be automatically determined macro(cmake_record_c_compile_features) set(_result 0) + if(_result EQUAL 0 AND DEFINED CMAKE_C23_STANDARD_COMPILE_OPTION) + _has_compiler_features_c(23) + endif() + if(_result EQUAL 0 AND DEFINED CMAKE_C17_STANDARD_COMPILE_OPTION) + _has_compiler_features_c(17) + endif() if(_result EQUAL 0 AND DEFINED CMAKE_C11_STANDARD_COMPILE_OPTION) if(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT) _has_compiler_features_c(11) diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index 5609abf..cf493d7 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -25,37 +25,60 @@ elseif("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") endif() endif() -if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) - if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") +if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2.1) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") - set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") - set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) + endif() + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.1) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") - set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) - else() - # clang-cl doesn't have any of these - set(CMAKE_C90_STANDARD_COMPILE_OPTION "") - set(CMAKE_C90_EXTENSION_COMPILE_OPTION "") - set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) + elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.0) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c1x") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x") + endif() + + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0) + set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17") + set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17") + endif() + + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0) + set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x") + set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x") + endif() +else() + set(CMAKE_C90_STANDARD_COMPILE_OPTION "") + set(CMAKE_C90_EXTENSION_COMPILE_OPTION "") + set(CMAKE_C99_STANDARD_COMPILE_OPTION "") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION "") - set(CMAKE_C99_STANDARD_COMPILE_OPTION "") - set(CMAKE_C99_EXTENSION_COMPILE_OPTION "") - set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "/std:c11") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "/std:c11") + set(CMAKE_C17_STANDARD_COMPILE_OPTION "/std:c17") + set(CMAKE_C17_EXTENSION_COMPILE_OPTION "/std:c17") + else() set(CMAKE_C11_STANDARD_COMPILE_OPTION "") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "") - set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_C17_STANDARD_COMPILE_OPTION "") + set(CMAKE_C17_EXTENSION_COMPILE_OPTION "") endif() endif() -if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") - __compiler_check_default_language_standard(C 3.4 99 3.6 11) -else() - set(CMAKE_C_STANDARD_DEFAULT "") +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2.1) + set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) endif() + +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.0) + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) +endif() + +__compiler_check_default_language_standard(C 2.1 99 3.5.2 11 11.0 17) diff --git a/Modules/Compiler/Clang-CUDA.cmake b/Modules/Compiler/Clang-CUDA.cmake index cafc7dd..0223081 100644 --- a/Modules/Compiler/Clang-CUDA.cmake +++ b/Modules/Compiler/Clang-CUDA.cmake @@ -22,8 +22,8 @@ set(_CMAKE_CUDA_PTX_FLAG "--cuda-device-only -S") set(_CMAKE_CUDA_DEVICE_CODE "-fgpu-rdc -c") # RulePlaceholderExpander expands crosscompile variables like sysroot and target only for CMAKE_<LANG>_COMPILER. Override the default. -set(CMAKE_CUDA_LINK_EXECUTABLE "<CMAKE_CUDA_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_LINKS}") -set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_COMPILER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}") +set(CMAKE_CUDA_LINK_EXECUTABLE "<CMAKE_CUDA_COMPILER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICIT_LINKS}") +set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_COMPILER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICIT_LINKS}") set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC") set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static") diff --git a/Modules/Compiler/Fujitsu-C.cmake b/Modules/Compiler/Fujitsu-C.cmake new file mode 100644 index 0000000..dd31e43 --- /dev/null +++ b/Modules/Compiler/Fujitsu-C.cmake @@ -0,0 +1,20 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. +include(Compiler/Fujitsu) +__compiler_fujitsu(C) + +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4) + set(CMAKE_C90_STANDARD_COMPILE_OPTION -std=c89) + set(CMAKE_C90_EXTENSION_COMPILE_OPTION -std=gnu89) + set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_C99_STANDARD_COMPILE_OPTION -std=c99) + set(CMAKE_C99_EXTENSION_COMPILE_OPTION -std=gnu99) + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_C11_STANDARD_COMPILE_OPTION -std=c11) + set(CMAKE_C11_EXTENSION_COMPILE_OPTION -std=gnu11) + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) +endif() + +__compiler_check_default_language_standard(C 4 11) diff --git a/Modules/Compiler/Fujitsu-CXX.cmake b/Modules/Compiler/Fujitsu-CXX.cmake new file mode 100644 index 0000000..0f42196 --- /dev/null +++ b/Modules/Compiler/Fujitsu-CXX.cmake @@ -0,0 +1,47 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. +include(Compiler/Fujitsu) +__compiler_fujitsu(CXX) + +#set(CMAKE_PCH_EXTENSION .pch) +#set(CMAKE_PCH_EPILOGUE "#pragma hdrstop") +#set(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH --no_pch_messages -include <PCH_HEADER> --use_pch <PCH_FILE>) +#set(CMAKE_CXX_COMPILE_OPTIONS_CREATE_PCH --no_pch_messages -include <PCH_HEADER> --create_pch <PCH_FILE>) + +# The Fujitsu compiler offers both a 98 and 03 mode. These two are +# essentially interchangeable as 03 simply provides clarity to some 98 +# ambiguyity. +# +# Re: Stroustrup's C++ FAQ: +# What is the difference between C++98 and C++03? +# From a programmer's view there is none. The C++03 revision of the +# standard was a bug fix release for implementers to ensure greater +# consistency and portability. In particular, tutorial and reference +# material describing C++98 and C++03 can be used interchangeably by all +# except compiler writers and standards gurus. +# +# Since CMake doesn't actually have an 03 mode and they're effectively +# interchangeable then we're just going to explicitly use 03 mode in the +# compiler when 98 is requested. + +# The version matching is messy here. The std support seems to be related to +# the compiler tweak version derived from the patch id in the version string. + +if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 4) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -std=c++03) + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -std=gnu++03) + set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -std=c++11) + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -std=gnu++11) + set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION -std=c++14) + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -std=gnu++14) + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) + + set(CMAKE_CXX17_STANDARD_COMPILE_OPTION -std=c++17) + set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION -std=gnu++17) +endif() + +__compiler_check_default_language_standard(CXX 4 14) diff --git a/Modules/Compiler/Fujitsu-DetermineCompiler.cmake b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake index 73ee38c..8534916 100644 --- a/Modules/Compiler/Fujitsu-DetermineCompiler.cmake +++ b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake @@ -1,2 +1,17 @@ -set(_compiler_id_pp_test "defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)") +set(_compiler_id_pp_test "defined(__FUJITSU)") + +set(_compiler_id_version_compute " +# if defined(__FCC_version__) +# define @PREFIX@COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__FCC_major__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__FCC_minor__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__fcc_version) +# elif defined(__FCC_VERSION) +# define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__FCC_VERSION) +# endif +") diff --git a/Modules/Compiler/Fujitsu-Fortran.cmake b/Modules/Compiler/Fujitsu-Fortran.cmake new file mode 100644 index 0000000..face2d6 --- /dev/null +++ b/Modules/Compiler/Fujitsu-Fortran.cmake @@ -0,0 +1,16 @@ +include(Compiler/Fujitsu) +__compiler_fujitsu(Fortran) + +set(CMAKE_Fortran_SUBMODULE_SEP ".") +set(CMAKE_Fortran_SUBMODULE_EXT ".smod") + +set(CMAKE_Fortran_PREPROCESS_SOURCE + "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -Cpp -P <SOURCE> -o <PREPROCESSED_SOURCE>") +set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-Cpp") + +set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-Fixed") +set(CMAKE_Fortran_FORMAT_FREE_FLAG "-Free") + +string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT "") + +set(CMAKE_Fortran_MODDIR_FLAG "-M ") diff --git a/Modules/Compiler/Fujitsu.cmake b/Modules/Compiler/Fujitsu.cmake new file mode 100644 index 0000000..13bc57c --- /dev/null +++ b/Modules/Compiler/Fujitsu.cmake @@ -0,0 +1,33 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# This module is shared by multiple languages; use include blocker. +if(__COMPILER_FUJITSU) + return() +endif() +set(__COMPILER_FUJITSU 1) + +include(Compiler/CMakeCommonCompilerMacros) + +macro(__compiler_fujitsu lang) + set(CMAKE_${lang}_VERBOSE_FLAG "-###") + + # Initial configuration flags + string(APPEND CMAKE_${lang}_FLAGS_INIT " ") + string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -O0") + string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG") + + # PIC flags + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") + + # Passing link options to the compiler + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,") + set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",") + + # How to actually call the compiler + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E $<$<COMPILE_LANGUAGE:Fortran>:-Cpp> <SOURCE> > <PREPROCESSED_SOURCE>") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") +endmacro() diff --git a/Modules/Compiler/FujitsuClang-C.cmake b/Modules/Compiler/FujitsuClang-C.cmake new file mode 100644 index 0000000..f700d2d --- /dev/null +++ b/Modules/Compiler/FujitsuClang-C.cmake @@ -0,0 +1,6 @@ +include(Compiler/FujitsuClang) + +set(_fjclang_ver "${CMAKE_C_COMPILER_VERSION_INTERNAL}") +set(CMAKE_C_COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION_INTERNAL}") +include(Compiler/Clang-C) +set(CMAKE_C_COMPILER_VERSION "${_fjclang_ver}") diff --git a/Modules/Compiler/FujitsuClang-CXX.cmake b/Modules/Compiler/FujitsuClang-CXX.cmake new file mode 100644 index 0000000..c8790cd --- /dev/null +++ b/Modules/Compiler/FujitsuClang-CXX.cmake @@ -0,0 +1,6 @@ +include(Compiler/FujitsuClang) + +set(_fjclang_ver "${CMAKE_CXX_COMPILER_VERSION_INTERNAL}") +set(CMAKE_CXX_COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION_INTERNAL}") +include(Compiler/Clang-CXX) +set(CMAKE_CXX_COMPILER_VERSION "${_fjclang_ver}") diff --git a/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake b/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake new file mode 100644 index 0000000..f6719b1 --- /dev/null +++ b/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake @@ -0,0 +1,9 @@ + +set(_compiler_id_pp_test "defined(__CLANG_FUJITSU)") + +set(_compiler_id_version_compute " +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__FCC_major__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__FCC_minor__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__FCC_patchlevel__) +# define @PREFIX@COMPILER_VERSION_INTERNAL_STR __clang_version__ +") diff --git a/Modules/Compiler/FujitsuClang.cmake b/Modules/Compiler/FujitsuClang.cmake new file mode 100644 index 0000000..a848248 --- /dev/null +++ b/Modules/Compiler/FujitsuClang.cmake @@ -0,0 +1,11 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +if(__COMPILER_FUJITSUCLANG) + return() +endif() +set(__COMPILER_FUJITSUCLANG 1) + +include(Compiler/Clang) diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake index 86b4d83..39e9c72 100644 --- a/Modules/Compiler/GNU-C.cmake +++ b/Modules/Compiler/GNU-C.cmake @@ -36,4 +36,14 @@ elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x") endif() -__compiler_check_default_language_standard(C 3.4 90 5.0 11) +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1) + set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17") + set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17") +endif() + +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9.1) + set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c23") + set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu23") +endif() + +__compiler_check_default_language_standard(C 3.4 90 5.0 11 8.1 17) diff --git a/Modules/Compiler/IntelLLVM-C.cmake b/Modules/Compiler/IntelLLVM-C.cmake index fce2971..beb7132 100644 --- a/Modules/Compiler/IntelLLVM-C.cmake +++ b/Modules/Compiler/IntelLLVM-C.cmake @@ -37,6 +37,9 @@ if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") + + set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17") + set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17") else() # clang-cl doesn't have any of these set(CMAKE_C90_STANDARD_COMPILE_OPTION "") @@ -47,12 +50,13 @@ else() set(CMAKE_C11_STANDARD_COMPILE_OPTION "") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "") + + set(CMAKE_C17_STANDARD_COMPILE_OPTION "") + set(CMAKE_C17_EXTENSION_COMPILE_OPTION "") endif() if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") - # FIXME: The compiler actually defaults to C17, but - # CMake does not yet model or detect that standard. - __compiler_check_default_language_standard(C 2020 11) + __compiler_check_default_language_standard(C 2020 17) else() set(CMAKE_C_STANDARD_DEFAULT "") endif() diff --git a/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake b/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake index 124dafe..917a364 100644 --- a/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake +++ b/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake @@ -4,7 +4,7 @@ set(_compiler_id_pp_test "(defined(__clang__) && defined(__INTEL_CLANG_COMPILER) set(_compiler_id_version_compute " /* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and * later. Look for 6 digit vs. 8 digit version number to decide encoding. - * VVVV is no smaller than the current year when a versio is released. + * VVVV is no smaller than the current year when a version is released. */ #if __INTEL_LLVM_COMPILER < 1000000L # define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEL_LLVM_COMPILER/100) diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake index a0f7c05..c2fe42d 100644 --- a/Modules/Compiler/NVIDIA-CUDA.cmake +++ b/Modules/Compiler/NVIDIA-CUDA.cmake @@ -24,21 +24,17 @@ else() set(_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS "") endif() +if(CMAKE_CUDA_HOST_COMPILER AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") + string(APPEND _CMAKE_CUDA_EXTRA_FLAGS " -ccbin=<CMAKE_CUDA_HOST_COMPILER>") +endif() + if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89) # The -MD flag was only added to nvcc in 10.2 so # before that we had to invoke the compiler twice # to get header dependency information set(CMAKE_DEPFILE_FLAGS_CUDA "-MD -MT <DEP_TARGET> -MF <DEP_FILE>") else() - if(CMAKE_CUDA_HOST_COMPILER AND NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") - # FIXME: Move the main -ccbin= flag from CMakeCUDAInformation to - # a block above, remove this copy, and update the VS generator too. - set(_CMAKE_CUDA_EXTRA_FLAGS_LOCAL " -ccbin=<CMAKE_CUDA_HOST_COMPILER>") - else() - set(_CMAKE_CUDA_EXTRA_FLAGS_LOCAL "") - endif() - set(CMAKE_CUDA_DEPENDS_EXTRA_COMMANDS "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS}${_CMAKE_CUDA_EXTRA_FLAGS_LOCAL} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o <DEP_FILE>") - unset(_CMAKE_CUDA_EXTRA_FLAGS_LOCAL) + set(CMAKE_CUDA_DEPENDS_EXTRA_COMMANDS "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o <DEP_FILE>") endif() set(CMAKE_CUDA_DEPFILE_FORMAT gcc) if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index d6fbae9..189374b 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -941,14 +941,15 @@ function(_ExternalData_link_or_copy src dst) file(RELATIVE_PATH tgt "${dst_dir}" "${src}") endif() endif() - execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${tgt}" "${tmp}" RESULT_VARIABLE result) + # Create link (falling back to copying if there's a problem). + file(CREATE_LINK "${tgt}" "${tmp}" RESULT result COPY_ON_ERROR SYMBOLIC) else() # Create a copy. - execute_process(COMMAND "${CMAKE_COMMAND}" -E copy "${src}" "${tmp}" RESULT_VARIABLE result) + file(COPY_FILE "${src}" "${tmp}" RESULT result) endif() if(result) file(REMOVE "${tmp}") - message(FATAL_ERROR "Failed to create\n ${tmp}\nfrom\n ${obj}") + message(FATAL_ERROR "Failed to create:\n \"${tmp}\"\nfrom:\n \"${obj}\"\nwith error:\n ${result}") endif() # Atomically create/replace the real destination. @@ -1101,7 +1102,14 @@ function(_ExternalData_download_object name hash algo var_obj var_success var_er set(success 1) if(found) - file(RENAME "${tmp}" "${obj}") + # Atomically create the object. If we lose a race with another process, + # do not replace it. Content-addressing ensures it has what we expect. + file(RENAME "${tmp}" "${obj}" NO_REPLACE RESULT result) + if (result STREQUAL "NO_REPLACE") + file(REMOVE "${tmp}") + elseif (result) + message(FATAL_ERROR "Failed to rename:\n \"${tmp}\"\nto:\n \"${obj}\"\nwith error:\n ${result}") + endif() message(STATUS "Downloaded object: \"${obj}\"") elseif(EXISTS "${staged}") set(obj "${staged}") diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 56525080..45b6124 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -212,7 +212,7 @@ External Project Definition ``TLS_VERIFY <bool>`` Specifies whether certificate verification should be performed for https URLs. If this option is not provided, the default behavior is - determined by the ``CMAKE_TLS_VERIFY`` variable (see + determined by the :variable:`CMAKE_TLS_VERIFY` variable (see :command:`file(DOWNLOAD)`). If that is also not set, certificate verification will not be performed. In situations where ``URL_HASH`` cannot be provided, this option can be an alternative verification diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index 8adef47..f5de930 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -34,7 +34,7 @@ The following shows a typical example of declaring content details: FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG release-1.8.0 + GIT_TAG 703bd9caab50b139428cea1aaff9974ebee5742e # release-1.10.0 ) For most typical cases, populating the content can then be done with a single @@ -126,13 +126,13 @@ Declaring Content Details FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG release-1.8.0 + GIT_TAG 703bd9caab50b139428cea1aaff9974ebee5742e # release-1.10.0 ) FetchContent_Declare( myCompanyIcons URL https://intranet.mycompany.com/assets/iconset_1.12.tar.gz - URL_HASH 5588a7b18261c20068beabfb4f530b87 + URL_HASH MD5=5588a7b18261c20068beabfb4f530b87 ) FetchContent_Declare( @@ -141,6 +141,11 @@ Declaring Content Details SVN_REVISION -r12345 ) + Where contents are being fetched from a remote location and you do not + control that server, it is advisable to use a hash for ``GIT_TAG`` rather + than a branch or tag name. A commit hash is more secure and helps to + confirm that the downloaded contents are what you expected. + Populating The Content """""""""""""""""""""" @@ -291,7 +296,7 @@ is simpler and provides additional features over the pattern above. The ``FetchContent_Populate()`` command also supports a syntax allowing the content details to be specified directly rather than using any saved details. This is more low-level and use of this form is generally to be - avoided in favour of using saved content details as outlined above. + avoided in favor of using saved content details as outlined above. Nevertheless, in certain situations it can be useful to invoke the content population as an isolated operation (typically as part of implementing some other higher level feature or when using CMake in script mode): @@ -456,12 +461,12 @@ frameworks are available to the main build: FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG release-1.8.0 + GIT_TAG 703bd9caab50b139428cea1aaff9974ebee5742e # release-1.10.0 ) FetchContent_Declare( Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v2.5.0 + GIT_TAG de6fe184a9ac1a06895cdd1c9b437f0a0bdf14ad # v2.13.4 ) # After the following call, the CMake targets defined by googletest and @@ -480,7 +485,7 @@ it into the main build: FetchContent_Declare( protobuf GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git - GIT_TAG v3.12.0 + GIT_TAG ae50d9b9902526efd6c7a1907d09739f959c6297 # v3.15.0 SOURCE_SUBDIR cmake ) set(protobuf_BUILD_TESTS OFF) @@ -517,7 +522,7 @@ that all five projects are available on a company git server. The FetchContent_Declare( projE GIT_REPOSITORY git@mycompany.com:git/projE.git - GIT_TAG origin/release/2.3-rc1 + GIT_TAG v2.3-rc1 ) # Order is important, see notes in the discussion further below @@ -1048,7 +1053,7 @@ function(FetchContent_Populate contentName) # Don't set global properties, or record that we did this population, since # this was a direct call outside of the normal declared details form. # We only want to save values in the global properties for content that - # honours the hierarchical details mechanism so that projects are not + # honors the hierarchical details mechanism so that projects are not # robbed of the ability to override details set in nested projects. return() endif() diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index b4650b2..024ff14 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -55,6 +55,8 @@ The following variables may be set to influence this module's behavior: * ``Arm_ilp64_mp`` * ``EML`` * ``EML_mt`` + * ``Fujitsu_SSL2`` (Fujitsu serial blas / lapack) + * ``Fujitsu_SSL2BLAMP`` (Fujitsu parallel blas / lapack) * ``Generic`` .. versionadded:: 3.6 @@ -78,6 +80,7 @@ The following variables may be set to influence this module's behavior: .. versionadded:: 3.20 Elbrus Math Library support (``EML``, ``EML_mt``). + Fujitsu SSL2 Library support (``Fujitsu_SSL2``, ``Fujitsu_SSL2BLAMP``) ``BLA_F95`` if ``ON`` tries to find the BLAS95 interfaces @@ -153,13 +156,18 @@ if(NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_CO endif() function(_add_blas_target) - if(NOT TARGET BLAS::BLAS) + if(BLAS_FOUND AND NOT TARGET BLAS::BLAS) add_library(BLAS::BLAS INTERFACE IMPORTED) if(BLAS_LIBRARIES) set_target_properties(BLAS::BLAS PROPERTIES INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}" ) endif() + if(BLAS_LINKER_FLAGS) + set_target_properties(BLAS::BLAS PROPERTIES + INTERFACE_LINK_OPTIONS "${BLAS_LINKER_FLAGS}" + ) + endif() endif() endfunction() @@ -168,10 +176,7 @@ if(CMAKE_Fortran_COMPILER_LOADED) else() include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) endif() -include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -cmake_push_check_state() -set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY}) if(BLA_PREFER_PKGCONFIG) find_package(PkgConfig) @@ -184,40 +189,33 @@ if(BLA_PREFER_PKGCONFIG) endif() endif() -set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) -if(BLA_STATIC) - if(WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else() - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif() -else() - if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - # for ubuntu's libblas3gf and liblapack3gf packages - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) - endif() -endif() - # TODO: move this stuff to a separate module -macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _addlibdir _subdirs) - # This macro checks for the existence of the combination of fortran libraries - # given by _list. If the combination is found, this macro checks (using the - # Check_Fortran_Function_Exists macro) whether can link against that library - # combination using the name of a routine given by _name using the linker - # flags given by _flags. If the combination of libraries is found and passes - # the link test, LIBRARIES is set to the list of complete library paths that - # have been found. Otherwise, LIBRARIES is set to FALSE. - - # N.B. _prefix is the prefix applied to the names of all cached variables that - # are generated internally and marked advanced by this macro. - # _addlibdir is a list of additional search paths. _subdirs is a list of path - # suffixes to be used by find_library(). +function(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlibdir _subdirs) + # This function checks for the existence of the combination of libraries + # given by _list. If the combination is found, this checks whether can link + # against that library combination using the name of a routine given by _name + # using the linker flags given by _flags. If the combination of libraries is + # found and passes the link test, ${LIBRARIES} is set to the list of complete + # library paths that have been found. Otherwise, ${LIBRARIES} is set to FALSE. set(_libraries_work TRUE) - set(${LIBRARIES}) + set(_libraries) set(_combined_name) + if(BLA_STATIC) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() + else() + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # for ubuntu's libblas3gf and liblapack3gf packages + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) + endif() + endif() + set(_extaddlibdir "${_addlibdir}") if(WIN32) list(APPEND _extaddlibdir ENV LIB) @@ -229,33 +227,37 @@ macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _add list(APPEND _extaddlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") foreach(_library ${_list}) - if(_library MATCHES "^-Wl,--(start|end)-group$") - # Respect linker flags like --start/end-group (required by MKL) - set(${LIBRARIES} ${${LIBRARIES}} "${_library}") + if(_library MATCHES "^-") + # Respect linker flags as-is (required by MKL) + list(APPEND _libraries "${_library}") else() - set(_combined_name ${_combined_name}_${_library}) - if(NOT "${_threadlibs}" STREQUAL "") - set(_combined_name ${_combined_name}_threadlibs) + string(REGEX REPLACE "[^A-Za-z0-9]" "_" _lib_var "${_library}") + set(_combined_name ${_combined_name}_${_lib_var}) + if(NOT "${_deps}" STREQUAL "") + set(_combined_name ${_combined_name}_deps) endif() if(_libraries_work) - find_library(${_prefix}_${_library}_LIBRARY + find_library(${_prefix}_${_lib_var}_LIBRARY NAMES ${_library} NAMES_PER_DIR PATHS ${_extaddlibdir} PATH_SUFFIXES ${_subdirs} ) - #message("DEBUG: find_library(${_library}) got ${${_prefix}_${_library}_LIBRARY}") - mark_as_advanced(${_prefix}_${_library}_LIBRARY) - set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) - set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) + mark_as_advanced(${_prefix}_${_lib_var}_LIBRARY) + list(APPEND _libraries ${${_prefix}_${_lib_var}_LIBRARY}) + set(_libraries_work ${${_prefix}_${_lib_var}_LIBRARY}) endif() endif() endforeach() + foreach(_flag ${_flags}) + string(REGEX REPLACE "[^A-Za-z0-9]" "_" _flag_var "${_flag}") + set(_combined_name ${_combined_name}_${_flag_var}) + endforeach() if(_libraries_work) # Test this combination of libraries. - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threadlibs}) - #message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") + set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${_libraries} ${_deps}) + set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY}) if(CMAKE_Fortran_COMPILER_LOADED) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) else() @@ -267,19 +269,20 @@ macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _add if(_libraries_work) if("${_list}" STREQUAL "") - set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES") + set(_libraries "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES") else() - set(${LIBRARIES} ${${LIBRARIES}} ${_threadlibs}) + list(APPEND _libraries ${_deps}) endif() else() - set(${LIBRARIES} FALSE) + set(_libraries FALSE) endif() - #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") -endmacro() + set(${LIBRARIES} "${_libraries}" PARENT_SCOPE) +endfunction() set(BLAS_LINKER_FLAGS) set(BLAS_LIBRARIES) set(BLAS95_LIBRARIES) +set(_blas_fphsa_req_var BLAS_LIBRARIES) if(NOT $ENV{BLA_VENDOR} STREQUAL "") set(BLA_VENDOR $ENV{BLA_VENDOR}) else() @@ -302,6 +305,9 @@ if(BLA_VENDOR STREQUAL "All") "" ) endif() + if(BLAS_WORKS) + set(_blas_fphsa_req_var BLAS_WORKS) + endif() endif() # BLAS in the Intel MKL 10+ library? @@ -327,12 +333,21 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") if(CMAKE_Fortran_COMPILER_LOADED AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND NOT APPLE) set(BLAS_mkl_INTFACE "gf") set(BLAS_mkl_THREADING "gnu") - set(BLAS_mkl_OMP "gomp") else() set(BLAS_mkl_INTFACE "intel") set(BLAS_mkl_THREADING "intel") - set(BLAS_mkl_OMP "iomp5") endif() + + foreach(lang IN ITEMS C CXX Fortran) + if(CMAKE_${lang}_COMPILER_LOADED) + find_package(OpenMP COMPONENTS ${lang}) + if(${OpenMP_${lang}_FOUND}) + set(BLAS_mkl_OMP ${OpenMP_${lang}_LIBRARIES}) + break() + endif() + endif() + endforeach() + set(BLAS_mkl_LM "-lm") set(BLAS_mkl_LDL "-ldl") endif() @@ -397,7 +412,7 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") # mkl >= 10.3 list(APPEND BLAS_SEARCH_LIBS - "${BLAS_mkl_START_GROUP} mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP} ${BLAS_mkl_OMP}") + "${BLAS_mkl_START_GROUP} mkl_blas95 mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP}") endif() if(BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All") # old version @@ -406,7 +421,7 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") # mkl >= 10.3 list(APPEND BLAS_SEARCH_LIBS - "${BLAS_mkl_START_GROUP} mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP} ${BLAS_mkl_OMP}") + "${BLAS_mkl_START_GROUP} mkl_blas95_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP}") endif() if(BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS @@ -462,7 +477,7 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") # mkl >= 10.3 list(APPEND BLAS_SEARCH_LIBS - "${BLAS_mkl_START_GROUP} mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP} ${BLAS_mkl_OMP}") + "${BLAS_mkl_START_GROUP} mkl_${BLAS_mkl_INTFACE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP}") endif() if(BLA_VENDOR MATCHES "^Intel10_64i?lp$" OR BLA_VENDOR STREQUAL "All") # old version @@ -471,7 +486,7 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") # mkl >= 10.3 list(APPEND BLAS_SEARCH_LIBS - "${BLAS_mkl_START_GROUP} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP} ${BLAS_mkl_OMP}") + "${BLAS_mkl_START_GROUP} mkl_${BLAS_mkl_INTFACE}_${BLAS_mkl_ILP_MODE} mkl_${BLAS_mkl_THREADING}_thread mkl_core ${BLAS_mkl_END_GROUP}") endif() if(BLA_VENDOR MATCHES "^Intel10_64i?lp_seq$" OR BLA_VENDOR STREQUAL "All") list(APPEND BLAS_SEARCH_LIBS @@ -534,7 +549,7 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") ${BLAS_mkl_SEARCH_SYMBOL} "" "${SEARCH_LIBS}" - "${CMAKE_THREAD_LIBS_INIT};${BLAS_mkl_LM};${BLAS_mkl_LDL}" + "${BLAS_mkl_OMP};${CMAKE_THREAD_LIBS_INIT};${BLAS_mkl_LM};${BLAS_mkl_LDL}" "${BLAS_mkl_MKLROOT}" "${BLAS_mkl_LIB_PATH_SUFFIXES}" ) @@ -619,8 +634,6 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") endif() set(_threadlibs "${CMAKE_THREAD_LIBS_INIT}") if(BLA_STATIC) - set(_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}") - set(CMAKE_FIND_LIBRARY_SUFFIXES "${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}") if (CMAKE_C_COMPILER_LOADED) find_package(OpenMP COMPONENTS C) list(PREPEND _threadlibs "${OpenMP_C_LIBRARIES}") @@ -628,8 +641,6 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") find_package(OpenMP COMPONENTS CXX) list(PREPEND _threadlibs "${OpenMP_CXX_LIBRARIES}") endif() - set(CMAKE_FIND_LIBRARY_SUFFIXES "${_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES}") - unset(_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES) endif() check_blas_libraries( BLAS_LIBRARIES @@ -1025,6 +1036,31 @@ if(BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All") endif() +# Fujitsu SSL2 Library? +if(NOT BLAS_LIBRARIES AND + BLA_VENDOR MATCHES "Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All") + if(BLA_VENDOR STREQUAL "Fujitsu_SSL2BLAMP") + set(_ssl2_suffix BLAMP) + else() + set(_ssl2_suffix) + endif() + check_blas_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "-SSL2${_ssl2_suffix}" + "" + "" + "" + "" + ) + if(BLAS_LIBRARIES) + set(BLAS_LINKER_FLAGS "-SSL2${_ssl2_suffix}") + set(_blas_fphsa_req_var BLAS_LINKER_FLAGS) + endif() + unset(_ssl2_suffix) +endif() + # Generic BLAS library? if(BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") if(NOT BLAS_LIBRARIES) @@ -1041,17 +1077,14 @@ if(BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") endif() endif() -if(NOT BLA_F95) - find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS_LIBRARIES) -endif() - - -# On compilers that implicitly link BLAS (such as ftn, cc, and CC on Cray HPC machines) -# we used a placeholder for empty BLAS_LIBRARIES to get through our logic above. +# On compilers that implicitly link BLAS (i.e. CrayPrgEnv) we used a +# placeholder for empty BLAS_LIBRARIES to get through our logic above. if(BLAS_LIBRARIES STREQUAL "BLAS_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES") set(BLAS_LIBRARIES "") endif() +if(NOT BLA_F95) + find_package_handle_standard_args(BLAS REQUIRED_VARS ${_blas_fphsa_req_var}) +endif() + _add_blas_target() -cmake_pop_check_state() -set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index d31f925..324ae27 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -189,7 +189,7 @@ This module defines the following :prop_tgt:`IMPORTED` targets: (adds ``-DBOOST_ALL_NO_LIB``). ``Boost::dynamic_linking`` - Interface target to enable dynamic linking linking with MSVC + Interface target to enable dynamic linking with MSVC (adds ``-DBOOST_ALL_DYN_LINK``). Implicit dependencies such as ``Boost::filesystem`` requiring diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index 5e25deb..bfa1d6f 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -76,7 +76,7 @@ endif() # cygwin ncurses stopped providing curses.h symlinks see above # message. Cygwin is an ncurses package, so force ncurses on # cygwin if the curses.h is missing -if(CYGWIN) +if(CURSES_NCURSES_LIBRARY AND CYGWIN) if (CURSES_NEED_WIDE) if(NOT EXISTS /usr/include/ncursesw/curses.h) set(CURSES_USE_NCURSES TRUE) diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake index 9984943..c8e5e31 100644 --- a/Modules/FindDevIL.cmake +++ b/Modules/FindDevIL.cmake @@ -10,26 +10,57 @@ FindDevIL This module locates the developer's image library. http://openil.sourceforge.net/ +IMPORTED Targets +^^^^^^^^^^^^^^^^ + +.. versionadded:: 3.21 + +This module defines the :prop_tgt:`IMPORTED` targets: + +``DevIL::IL`` + Defined if the system has DevIL. + +``DevIL::ILU`` + Defined if the system has DevIL Utilities. + +``DevIL::ILUT`` + Defined if the system has DevIL Utility Toolkit. + +Result Variables +^^^^^^^^^^^^^^^^ + This module sets: -:: - - IL_LIBRARIES - the name of the IL library. These include the full path to - the core DevIL library. This one has to be linked into the - application. - ILU_LIBRARIES - the name of the ILU library. Again, the full path. This - library is for filters and effects, not actual loading. It - doesn't have to be linked if the functionality it provides - is not used. - ILUT_LIBRARIES - the name of the ILUT library. Full path. This part of the - library interfaces with OpenGL. It is not strictly needed - in applications. - IL_INCLUDE_DIR - where to find the il.h, ilu.h and ilut.h files. - DevIL_FOUND - this is set to TRUE if all the above variables were set. - This will be set to false if ILU or ILUT are not found, - even if they are not needed. In most systems, if one - library is found all the others are as well. That's the - way the DevIL developers release it. +``IL_LIBRARIES`` + The name of the IL library. These include the full path to + the core DevIL library. This one has to be linked into the + application. + +``ILU_LIBRARIES`` + The name of the ILU library. Again, the full path. This + library is for filters and effects, not actual loading. It + doesn't have to be linked if the functionality it provides + is not used. + +``ILUT_LIBRARIES`` + The name of the ILUT library. Full path. This part of the + library interfaces with OpenGL. It is not strictly needed + in applications. + +``IL_INCLUDE_DIR`` + where to find the il.h, ilu.h and ilut.h files. + +``DevIL_FOUND`` + This is set to TRUE if all the above variables were set. + This will be set to false if ILU or ILUT are not found, + even if they are not needed. In most systems, if one + library is found all the others are as well. That's the + way the DevIL developers release it. + +``DevIL_ILUT_FOUND`` + .. versionadded:: 3.21 + + This is set to TRUE if the ILUT library is found. #]=======================================================================] # TODO: Add version support. @@ -73,3 +104,36 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(DevIL DEFAULT_MSG IL_INCLUDE_DIR) # provide legacy variable for compatibility set(IL_FOUND ${DevIL_FOUND}) + +# create imported targets ONLY if we found DevIL. +if(DevIL_FOUND) + # Report the ILUT found if ILUT_LIBRARIES contains valid path. + if (ILUT_LIBRARIES) + set(DevIL_ILUT_FOUND TRUE) + else() + set(DevIL_ILUT_FOUND FALSE) + endif() + + if(NOT TARGET DevIL::IL) + add_library(DevIL::IL UNKNOWN IMPORTED) + set_target_properties(DevIL::IL PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${IL_INCLUDE_DIR}" + IMPORTED_LOCATION "${IL_LIBRARIES}") + endif() + + # DevIL Utilities target + if(NOT TARGET DevIL::ILU) + add_library(DevIL::ILU UNKNOWN IMPORTED) + set_target_properties(DevIL::ILU PROPERTIES + IMPORTED_LOCATION "${ILU_LIBRARIES}") + target_link_libraries(DevIL::ILU INTERFACE DevIL::IL) + endif() + + # ILUT (if found) + if(NOT TARGET DevIL::ILUT AND DevIL_ILUT_FOUND) + add_library(DevIL::ILUT UNKNOWN IMPORTED) + set_target_properties(DevIL::ILUT PROPERTIES + IMPORTED_LOCATION "${ILUT_LIBRARIES}") + target_link_libraries(DevIL::ILUT INTERFACE DevIL::ILU) + endif() +endif() diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index bbf941e..4a16e31 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -223,7 +223,8 @@ them to be separated by whitespace. CMake variables hold lists as a string with items separated by semi-colons, so a conversion needs to be performed. The ``doxygen_add_docs()`` command specifically checks the following Doxygen config options and will convert their associated CMake variable's contents into the -required form if set. +required form if set. CMake variables are named ``DOXYGEN_<name>`` for the +Doxygen settings specified here. :: @@ -395,6 +396,7 @@ Deprecated Hint Variables #]=======================================================================] cmake_policy(PUSH) +cmake_policy(SET CMP0054 NEW) # quoted if arguments cmake_policy(SET CMP0057 NEW) # if IN_LIST # For backwards compatibility support diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake index e1e239a..bab7256 100644 --- a/Modules/FindFLTK.cmake +++ b/Modules/FindFLTK.cmake @@ -108,7 +108,7 @@ if(APPLE) set( FLTK_PLATFORM_DEPENDENT_LIBS "-framework Carbon -framework Cocoa -framework ApplicationServices -lz") endif() -# If FLTK_INCLUDE_DIR is already defined we assigne its value to FLTK_DIR +# If FLTK_INCLUDE_DIR is already defined we assign its value to FLTK_DIR. if(FLTK_INCLUDE_DIR) set(FLTK_DIR ${FLTK_INCLUDE_DIR}) endif() diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index 252f2ae..99e2887 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -39,7 +39,7 @@ LANGUAGES <lang1> <lang2> ... ) If INSTALL_DESTINATION is given then automatically install rules will be created, the language subdirectory will be taken into account (by default use share/locale/). - If ALL is specified, the pot file is processed when building the all traget. + If ALL is specified, the pot file is processed when building the all target. It creates a custom target "potfile". GETTEXT_PROCESS_PO_FILES( <lang> [ALL] [INSTALL_DESTINATION <dir>] @@ -51,7 +51,7 @@ PO_FILES <po1> <po2> ... ) If INSTALL_DESTINATION is given then automatically install rules will be created, the language subdirectory will be taken into account (by default use share/locale/). - If ALL is specified, the po files are processed when building the all traget. + If ALL is specified, the po files are processed when building the all target. It creates a custom target "pofiles". .. versionadded:: 3.2 diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake index ca2467d..b4ea6ab 100644 --- a/Modules/FindGnuplot.cmake +++ b/Modules/FindGnuplot.cmake @@ -23,6 +23,7 @@ GNUPLOT_VERSION_STRING will not work for old versions like 3.7.1. #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindMsys.cmake) find_program(GNUPLOT_EXECUTABLE NAMES @@ -31,6 +32,7 @@ find_program(GNUPLOT_EXECUTABLE wgnupl32 PATHS ${CYGWIN_INSTALL_PATH}/bin + ${MSYS_INSTALL_PATH}/usr/bin ) if (GNUPLOT_EXECUTABLE) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index ec5ebdd..e335355 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -811,25 +811,8 @@ if( NOT HDF5_FOUND ) endif() foreach(_lang IN LISTS HDF5_LANGUAGE_BINDINGS) - # find the HDF5 include directories - if("${_lang}" STREQUAL "Fortran") - set(HDF5_INCLUDE_FILENAME hdf5.mod HDF5.mod) - elseif("${_lang}" STREQUAL "CXX") - set(HDF5_INCLUDE_FILENAME H5Cpp.h) - else() - set(HDF5_INCLUDE_FILENAME hdf5.h) - endif() - - find_path(HDF5_${_lang}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME} - HINTS ${HDF5_ROOT} - PATHS $ENV{HOME}/.local/include - PATH_SUFFIXES include Include ${_inc_suffixes} ${_lib_suffixes} - ${_HDF5_SEARCH_OPTS} - ) - mark_as_advanced(HDF5_${_lang}_INCLUDE_DIR) - # set the _DIRS variable as this is what the user will normally use - set(HDF5_${_lang}_INCLUDE_DIRS ${HDF5_${_lang}_INCLUDE_DIR}) - list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${_lang}_INCLUDE_DIR}) + # The "main" library. + set(_hdf5_main_library "") # find the HDF5 libraries foreach(LIB IN LISTS HDF5_${_lang}_LIBRARY_NAMES) @@ -861,6 +844,15 @@ if( NOT HDF5_FOUND ) ${_HDF5_SEARCH_OPTS} ) + # Set the "main" library if not already set. + if (NOT _hdf5_main_library) + if (HDF5_${LIB}_LIBRARY_RELEASE) + set(_hdf5_main_library "${HDF5_${LIB}_LIBRARY_RELEASE}") + elseif (HDF5_${LIB}_LIBRARY_DEBUG) + set(_hdf5_main_library "${HDF5_${LIB}_LIBRARY_DEBUG}") + endif () + endif () + select_library_configurations( HDF5_${LIB} ) list(APPEND HDF5_${_lang}_LIBRARIES ${HDF5_${LIB}_LIBRARY}) endforeach() @@ -872,6 +864,43 @@ if( NOT HDF5_FOUND ) # required libraries. list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_LIBRARIES}) + # find the HDF5 include directories + set(_hdf5_inc_extra_paths) + set(_hdf5_inc_extra_suffixes) + if("${_lang}" STREQUAL "Fortran") + set(HDF5_INCLUDE_FILENAME hdf5.mod HDF5.mod) + + # Add library-based search paths for Fortran modules. + if (NOT _hdf5_main_library STREQUAL "") + # gfortran module directory + if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + get_filename_component(_hdf5_library_dir "${_hdf5_main_library}" DIRECTORY) + list(APPEND _hdf5_inc_extra_paths "${_hdf5_library_dir}") + unset(_hdf5_library_dir) + list(APPEND _hdf5_inc_extra_suffixes gfortran/modules) + endif () + endif () + elseif("${_lang}" STREQUAL "CXX") + set(HDF5_INCLUDE_FILENAME H5Cpp.h) + else() + set(HDF5_INCLUDE_FILENAME hdf5.h) + endif() + + unset(_hdf5_main_library) + + find_path(HDF5_${_lang}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME} + HINTS ${HDF5_ROOT} + PATHS $ENV{HOME}/.local/include ${_hdf5_inc_extra_paths} + PATH_SUFFIXES include Include ${_inc_suffixes} ${_lib_suffixes} ${_hdf5_inc_extra_suffixes} + ${_HDF5_SEARCH_OPTS} + ) + mark_as_advanced(HDF5_${_lang}_INCLUDE_DIR) + unset(_hdf5_inc_extra_paths) + unset(_hdf5_inc_extra_suffixes) + # set the _DIRS variable as this is what the user will normally use + set(HDF5_${_lang}_INCLUDE_DIRS ${HDF5_${_lang}_INCLUDE_DIR}) + list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${_lang}_INCLUDE_DIR}) + if(HDF5_FIND_HL) foreach(LIB IN LISTS HDF5_${_lang}_HL_LIBRARY_NAMES) if(HDF5_USE_STATIC_LIBRARIES) diff --git a/Modules/FindIconv.cmake b/Modules/FindIconv.cmake index 41b7550..566330f 100644 --- a/Modules/FindIconv.cmake +++ b/Modules/FindIconv.cmake @@ -25,6 +25,24 @@ The following variables are provided to indicate iconv support: The iconv libraries to be linked. +.. variable:: Iconv_VERSION + + .. versionadded:: 3.21 + + The version of iconv found (x.y) + +.. variable:: Iconv_VERSION_MAJOR + + .. versionadded:: 3.21 + + The major version of iconv + +.. variable:: Iconv_VERSION_MINOR + + .. versionadded:: 3.21 + + The minor version of iconv + .. variable:: Iconv_IS_BUILT_IN A variable indicating whether iconv support is stemming from the @@ -51,6 +69,10 @@ The following cache variables may also be set: On POSIX platforms, iconv might be part of the C library and the cache variables ``Iconv_INCLUDE_DIR`` and ``Iconv_LIBRARY`` might be empty. +.. note:: + Some libiconv implementations don't embed the version number in their header files. + In this case the variables ``Iconv_VERSION*`` will be empty. + #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) @@ -100,37 +122,61 @@ if(NOT DEFINED Iconv_IS_BUILT_IN) endif() endif() -if(NOT Iconv_IS_BUILT_IN) +set(_Iconv_REQUIRED_VARS) +if(Iconv_IS_BUILT_IN) + set(_Iconv_REQUIRED_VARS _Iconv_IS_BUILT_IN_MSG) + set(_Iconv_IS_BUILT_IN_MSG "built in to C library") +else() + set(_Iconv_REQUIRED_VARS Iconv_LIBRARY Iconv_INCLUDE_DIR) + find_path(Iconv_INCLUDE_DIR NAMES "iconv.h" DOC "iconv include directory") set(Iconv_LIBRARY_NAMES "iconv" "libiconv") -else() - set(Iconv_INCLUDE_DIR "" CACHE FILEPATH "iconv include directory") - set(Iconv_LIBRARY_NAMES "c") + mark_as_advanced(Iconv_INCLUDE_DIR) + + find_library(Iconv_LIBRARY + NAMES iconv libiconv + NAMES_PER_DIR + DOC "iconv library (if not in the C library)") + mark_as_advanced(Iconv_LIBRARY) endif() -find_library(Iconv_LIBRARY - NAMES ${Iconv_LIBRARY_NAMES} - NAMES_PER_DIR - DOC "iconv library (potentially the C library)") +# NOTE: glibc's iconv.h does not define _LIBICONV_VERSION +if(Iconv_INCLUDE_DIR AND EXISTS "${Iconv_INCLUDE_DIR}/iconv.h") + file(STRINGS ${Iconv_INCLUDE_DIR}/iconv.h Iconv_VERSION_DEFINE REGEX "_LIBICONV_VERSION (.*)") -mark_as_advanced(Iconv_INCLUDE_DIR) -mark_as_advanced(Iconv_LIBRARY) + if(Iconv_VERSION_DEFINE MATCHES "(0x[A-Fa-f0-9]+)") + set(Iconv_VERSION_NUMBER "${CMAKE_MATCH_1}") + # encoding -> version number: (major<<8) + minor + math(EXPR Iconv_VERSION_MAJOR "${Iconv_VERSION_NUMBER} >> 8" OUTPUT_FORMAT HEXADECIMAL) + math(EXPR Iconv_VERSION_MINOR "${Iconv_VERSION_NUMBER} - (${Iconv_VERSION_MAJOR} << 8)" OUTPUT_FORMAT HEXADECIMAL) -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -if(NOT Iconv_IS_BUILT_IN) - find_package_handle_standard_args(Iconv REQUIRED_VARS Iconv_LIBRARY Iconv_INCLUDE_DIR) -else() - find_package_handle_standard_args(Iconv REQUIRED_VARS Iconv_LIBRARY) + math(EXPR Iconv_VERSION_MAJOR "${Iconv_VERSION_MAJOR}" OUTPUT_FORMAT DECIMAL) + math(EXPR Iconv_VERSION_MINOR "${Iconv_VERSION_MINOR}" OUTPUT_FORMAT DECIMAL) + set(Iconv_VERSION "${Iconv_VERSION_MAJOR}.${Iconv_VERSION_MINOR}") + endif() + + unset(Iconv_VERSION_DEFINE) + unset(Iconv_VERSION_NUMBER) endif() +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(Iconv + REQUIRED_VARS ${_Iconv_REQUIRED_VARS} + VERSION_VAR Iconv_VERSION) + if(Iconv_FOUND) - set(Iconv_INCLUDE_DIRS "${Iconv_INCLUDE_DIR}") - set(Iconv_LIBRARIES "${Iconv_LIBRARY}") + if(Iconv_IS_BUILT_IN) + set(Iconv_INCLUDE_DIRS "") + set(Iconv_LIBRARIES "") + else() + set(Iconv_INCLUDE_DIRS "${Iconv_INCLUDE_DIR}") + set(Iconv_LIBRARIES "${Iconv_LIBRARY}") + endif() if(NOT TARGET Iconv::Iconv) add_library(Iconv::Iconv INTERFACE IMPORTED) + set_property(TARGET Iconv::Iconv PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${Iconv_INCLUDE_DIRS}") + set_property(TARGET Iconv::Iconv PROPERTY INTERFACE_LINK_LIBRARIES "${Iconv_LIBRARIES}") endif() - set_property(TARGET Iconv::Iconv PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${Iconv_INCLUDE_DIRS}") - set_property(TARGET Iconv::Iconv PROPERTY INTERFACE_LINK_LIBRARIES "${Iconv_LIBRARIES}") endif() diff --git a/Modules/FindIntl.cmake b/Modules/FindIntl.cmake index 43398c1..95eeabd 100644 --- a/Modules/FindIntl.cmake +++ b/Modules/FindIntl.cmake @@ -24,6 +24,30 @@ installation in several variables. The intl libraries to be linked. +.. variable:: Intl_VERSION + + .. versionadded:: 3.21 + + The version of intl found (x.y.z) + +.. variable:: Intl_VERSION_MAJOR + + .. versionadded:: 3.21 + + The major version of intl + +.. variable:: Intl_VERSION_MINOR + + .. versionadded:: 3.21 + + The minor version of intl + +.. variable:: Intl_VERSION_PATCH + + .. versionadded:: 3.21 + + The patch version of intl + .. versionadded:: 3.20 This module defines :prop_tgt:`IMPORTED` target ``Intl::Intl``. @@ -50,6 +74,10 @@ The following cache variables may also be set: case. .. note:: + Some libintl implementations don't embed the version number in their header files. + In this case the variables ``Intl_VERSION*`` will be empty. + +.. note:: If you wish to use the Gettext tools (``msgmerge``, ``msgfmt``, etc.), use :module:`FindGettext`. #]=======================================================================] @@ -101,15 +129,39 @@ else() DOC "libintl include directory") mark_as_advanced(Intl_INCLUDE_DIR) - find_library(Intl_LIBRARY "intl" "libintl" NAMES_PER_DIR + find_library(Intl_LIBRARY + NAMES "intl" "libintl" + NAMES_PER_DIR DOC "libintl libraries (if not in the C library)") mark_as_advanced(Intl_LIBRARY) endif() +# NOTE: glibc's libintl.h does not define LIBINTL_VERSION +if(Intl_INCLUDE_DIR AND EXISTS "${Intl_INCLUDE_DIR}/libintl.h") + file(STRINGS ${Intl_INCLUDE_DIR}/libintl.h Intl_VERSION_DEFINE REGEX "LIBINTL_VERSION (.*)") + + if(Intl_VERSION_DEFINE MATCHES "(0x[A-Fa-f0-9]+)") + set(Intl_VERSION_NUMBER "${CMAKE_MATCH_1}") + # encoding -> version number: (major<<16) + (minor<<8) + patch + math(EXPR Intl_VERSION_MAJOR "${Intl_VERSION_NUMBER} >> 16" OUTPUT_FORMAT HEXADECIMAL) + math(EXPR Intl_VERSION_MINOR "(${Intl_VERSION_NUMBER} - (${Intl_VERSION_MAJOR} << 16)) >> 8" OUTPUT_FORMAT HEXADECIMAL) + math(EXPR Intl_VERSION_PATCH "${Intl_VERSION_NUMBER} - ((${Intl_VERSION_MAJOR} << 16) + (${Intl_VERSION_MINOR} << 8))" OUTPUT_FORMAT HEXADECIMAL) + + math(EXPR Intl_VERSION_MAJOR "${Intl_VERSION_MAJOR}" OUTPUT_FORMAT DECIMAL) + math(EXPR Intl_VERSION_MINOR "${Intl_VERSION_MINOR}" OUTPUT_FORMAT DECIMAL) + math(EXPR Intl_VERSION_PATCH "${Intl_VERSION_PATCH}" OUTPUT_FORMAT DECIMAL) + set(Intl_VERSION "${Intl_VERSION_MAJOR}.${Intl_VERSION_MINOR}.${Intl_VERSION_PATCH}") + endif() + + unset(Intl_VERSION_DEFINE) + unset(Intl_VERSION_NUMBER) +endif() + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Intl FOUND_VAR Intl_FOUND REQUIRED_VARS ${_Intl_REQUIRED_VARS} + VERSION_VAR Intl_VERSION FAIL_MESSAGE "Failed to find Gettext libintl") unset(_Intl_REQUIRED_VARS) unset(_Intl_IS_BUILT_IN_MSG) diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index 5aa2d60..e4f60b3 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -80,7 +80,7 @@ macro(java_append_library_directories _var) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") set(_java_libarch "ppc" "ppc64") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") - # Both flavours can run on the same processor + # Both flavors can run on the same processor set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)") set(_java_libarch "parisc" "parisc64") diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 45e4be7..ab6214b 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -45,6 +45,8 @@ The following variables may be set to influence this module's behavior: * ``Arm_ilp64_mp`` * ``EML`` * ``EML_mt`` + * ``Fujitsu_SSL2`` (Fujitsu serial blas / lapack) + * ``Fujitsu_SSL2BLAMP`` (Fujitsu parallel blas / lapack) * ``Generic`` .. versionadded:: 3.6 @@ -68,6 +70,7 @@ The following variables may be set to influence this module's behavior: .. versionadded:: 3.20 Elbrus Math Library support (``EML``, ``EML_mt``). + Fujitsu SSL2 Library support (``Fujitsu_SSL2``, ``Fujitsu_SSL2BLAMP``) ``BLA_F95`` if ``ON`` tries to find the BLAS95/LAPACK95 interfaces @@ -124,34 +127,55 @@ if(CMAKE_Fortran_COMPILER_LOADED) else() include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) endif() -include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) function(_add_lapack_target) if(LAPACK_FOUND AND NOT TARGET LAPACK::LAPACK) add_library(LAPACK::LAPACK INTERFACE IMPORTED) + + # Filter out redundant BLAS info and replace with the BLAS target set(_lapack_libs "${LAPACK_LIBRARIES}") - if(_lapack_libs AND TARGET BLAS::BLAS) - # remove the ${BLAS_LIBRARIES} from the interface and replace it - # with the BLAS::BLAS target - list(REMOVE_ITEM _lapack_libs "${BLAS_LIBRARIES}") + set(_lapack_flags "${LAPACK_LINKER_FLAGS}") + if(TARGET BLAS::BLAS) + if(_lapack_libs AND BLAS_LIBRARIES) + foreach(_blas_lib IN LISTS BLAS_LIBRARIES) + list(REMOVE_ITEM _lapack_libs "${_blas_lib}") + endforeach() + endif() + if(_lapack_flags AND BLAS_LINKER_FLAGS) + foreach(_blas_flag IN LISTS BLAS_LINKER_FLAGS) + list(REMOVE_ITEM _lapack_flags "${_blas_flag}") + endforeach() + endif() list(APPEND _lapack_libs BLAS::BLAS) endif() - if(_lapack_libs) set_target_properties(LAPACK::LAPACK PROPERTIES INTERFACE_LINK_LIBRARIES "${_lapack_libs}" ) endif() - unset(_lapack_libs) + if(_lapack_flags) + set_target_properties(LAPACK::LAPACK PROPERTIES + INTERFACE_LINK_OPTIONS "${_lapack_flags}" + ) + endif() endif() endfunction() -macro(_lapack_find_library_setup) - cmake_push_check_state() - set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY}) +# TODO: move this stuff to a separate module + +function(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlibdir _subdirs _blas) + # This function checks for the existence of the combination of libraries + # given by _list. If the combination is found, this checks whether can link + # against that library combination using the name of a routine given by _name + # using the linker flags given by _flags. If the combination of libraries is + # found and passes the link test, ${LIBRARIES} is set to the list of complete + # library paths that have been found. Otherwise, ${LIBRARIES} is set to FALSE. + + set(_libraries_work TRUE) + set(_libraries) + set(_combined_name) - set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) if(BLA_STATIC) if(WIN32) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) @@ -164,33 +188,6 @@ macro(_lapack_find_library_setup) set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) endif() endif() -endmacro() - -macro(_lapack_find_library_teardown) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) - unset(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) - cmake_pop_check_state() -endmacro() - -# TODO: move this stuff to a separate module - -macro(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _addlibdir _subdirs _blas) - # This macro checks for the existence of the combination of fortran libraries - # given by _list. If the combination is found, this macro checks (using the - # Check_Fortran_Function_Exists macro) whether can link against that library - # combination using the name of a routine given by _name using the linker - # flags given by _flags. If the combination of libraries is found and passes - # the link test, LIBRARIES is set to the list of complete library paths that - # have been found. Otherwise, LIBRARIES is set to FALSE. - - # N.B. _prefix is the prefix applied to the names of all cached variables that - # are generated internally and marked advanced by this macro. - # _addlibdir is a list of additional search paths. _subdirs is a list of path - # suffixes to be used by find_library(). - - set(_libraries_work TRUE) - set(${LIBRARIES}) - set(_combined_name) set(_extaddlibdir "${_addlibdir}") if(WIN32) @@ -203,31 +200,37 @@ macro(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _a list(APPEND _extaddlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") foreach(_library ${_list}) - if(_library MATCHES "^-Wl,--(start|end)-group$") - # Respect linker flags like --start/end-group (required by MKL) - set(${LIBRARIES} ${${LIBRARIES}} "${_library}") + if(_library MATCHES "^-") + # Respect linker flags as-is (required by MKL) + list(APPEND _libraries "${_library}") else() - set(_combined_name ${_combined_name}_${_library}) + string(REGEX REPLACE "[^A-Za-z0-9]" "_" _lib_var "${_library}") + set(_combined_name ${_combined_name}_${_lib_var}) + if(NOT "${_deps}" STREQUAL "") + set(_combined_name ${_combined_name}_deps) + endif() if(_libraries_work) - find_library(${_prefix}_${_library}_LIBRARY + find_library(${_prefix}_${_lib_var}_LIBRARY NAMES ${_library} NAMES_PER_DIR PATHS ${_extaddlibdir} PATH_SUFFIXES ${_subdirs} ) - #message("DEBUG: find_library(${_library}) got ${${_prefix}_${_library}_LIBRARY}") - mark_as_advanced(${_prefix}_${_library}_LIBRARY) - set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) - set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) + mark_as_advanced(${_prefix}_${_lib_var}_LIBRARY) + list(APPEND _libraries ${${_prefix}_${_lib_var}_LIBRARY}) + set(_libraries_work ${${_prefix}_${_lib_var}_LIBRARY}) endif() endif() endforeach() - unset(_library) + foreach(_flag ${_flags}) + string(REGEX REPLACE "[^A-Za-z0-9]" "_" _flag_var "${_flag}") + set(_combined_name ${_combined_name}_${_flag_var}) + endforeach() if(_libraries_work) # Test this combination of libraries. - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threadlibs}) - #message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") + set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${_libraries} ${_blas} ${_deps}) + set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY}) if(CMAKE_Fortran_COMPILER_LOADED) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) else() @@ -239,19 +242,15 @@ macro(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _a if(_libraries_work) if("${_list}${_blas}" STREQUAL "") - set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES") + set(_libraries "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES") else() - set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threadlibs}) + list(APPEND _libraries ${_blas} ${_deps}) endif() else() - set(${LIBRARIES} FALSE) + set(_libraries FALSE) endif() - - unset(_extaddlibdir) - unset(_libraries_work) - unset(_combined_name) - #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") -endmacro() + set(${LIBRARIES} "${_libraries}" PARENT_SCOPE) +endfunction() macro(_lapack_find_dependency dep) set(_lapack_quiet_arg) @@ -274,11 +273,10 @@ macro(_lapack_find_dependency dep) set(_lapack_quiet_arg) endmacro() -_lapack_find_library_setup() - set(LAPACK_LINKER_FLAGS) set(LAPACK_LIBRARIES) set(LAPACK95_LIBRARIES) +set(_lapack_fphsa_req_var LAPACK_LIBRARIES) # Check the language being used if(NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED)) @@ -585,22 +583,62 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) ) endif() + # Fujitsu SSL2 Library? + if(NOT LAPACK_LIBRARIES + AND BLA_VENDOR MATCHES "Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All") + if(BLA_VENDOR STREQUAL "Fujitsu_SSL2BLAMP") + set(_ssl2_suffix BLAMP) + else() + set(_ssl2_suffix) + endif() + set(_ssl2_blas) + if(BLAS_LIBRARIES STREQUAL "") + set(_ssl2_blas "${BLAS_LINKER_FLAGS}") + else() + set(_ssl2_blas "${BLAS_LIBRARIES} ${BLAS_LINKER_FLAGS}") + endif() + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "-SSL2${_ssl2_suffix}" + "" + "" + "" + "" + "${_ssl2_blas}" + ) + if(LAPACK_LIBRARIES) + set(LAPACK_LINKER_FLAGS "-SSL2${_ssl2_suffix}") + set(_lapack_fphsa_req_var LAPACK_LINKER_FLAGS) + endif() + unset(_ssl2_suffix) + endif() + # Generic LAPACK library? if(NOT LAPACK_LIBRARIES AND (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")) + if(BLA_STATIC) + # We do not know for sure how the LAPACK reference implementation + # is built on this host. Guess typical dependencies. + set(_lapack_generic_deps "-lgfortran;-lm") + else() + set(_lapack_generic_deps "") + endif() check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev "" "lapack" - "" + "${_lapack_generic_deps}" "" "" "${BLAS_LIBRARIES}" ) + unset(_lapack_generic_deps) endif() endif() @@ -612,7 +650,7 @@ if(LAPACK_NOT_FOUND_MESSAGE) set(LAPACK_NOT_FOUND_MESSAGE REASON_FAILURE_MESSAGE ${LAPACK_NOT_FOUND_MESSAGE}) endif() -find_package_handle_standard_args(LAPACK REQUIRED_VARS LAPACK_LIBRARIES +find_package_handle_standard_args(LAPACK REQUIRED_VARS ${_lapack_fphsa_req_var} ${LAPACK_NOT_FOUND_MESSAGE}) unset(LAPACK_NOT_FOUND_MESSAGE) @@ -627,5 +665,3 @@ if(LAPACK_LIBRARIES STREQUAL "LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES") endif() _add_lapack_target() - -_lapack_find_library_teardown() diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index de38ac2..c48decb 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -277,6 +277,11 @@ set(_MPI_Fortran_GENERIC_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r mpif77 mpif77_r mpf77 mpf77_r mpifc) +#Fujitsu cross/own compiler names +set(_MPI_Fujitsu_C_COMPILER_NAMES mpifccpx mpifcc) +set(_MPI_Fujitsu_CXX_COMPILER_NAMES mpiFCCpx mpiFCC) +set(_MPI_Fujitsu_Fortran_COMPILER_NAMES mpifrtpx mpifrt) + # GNU compiler names set(_MPI_GNU_C_COMPILER_NAMES mpigcc mpgcc mpigcc_r mpgcc_r) set(_MPI_GNU_CXX_COMPILER_NAMES mpig++ mpg++ mpig++_r mpg++_r mpigxx) @@ -337,7 +342,7 @@ set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95 # pick up the right settings for it. foreach (LANG IN ITEMS C CXX Fortran) set(_MPI_${LANG}_COMPILER_NAMES "") - foreach (id IN ITEMS GNU Intel IntelLLVM MSVC PGI XL) + foreach (id IN ITEMS Fujitsu FujitsuClang GNU Intel IntelLLVM MSVC PGI XL) if (NOT CMAKE_${LANG}_COMPILER_ID OR CMAKE_${LANG}_COMPILER_ID STREQUAL id) foreach(_COMPILER_NAME IN LISTS _MPI_${id}_${LANG}_COMPILER_NAMES) list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_COMPILER_NAME}${MPI_EXECUTABLE_SUFFIX}) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 2f56d15..c8df670 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -52,7 +52,7 @@ The module supports the following components: between the release name and the version. The variable :variable:`Matlab_ROOT_DIR` may be specified in order to give -the path of the desired Matlab version. Otherwise, the behaviour is platform +the path of the desired Matlab version. Otherwise, the behavior is platform specific: * Windows: The installed versions of Matlab/MCR are retrieved from the @@ -83,7 +83,7 @@ Module Input Variables ^^^^^^^^^^^^^^^^^^^^^^ Users or projects may set the following variables to configure the module -behaviour: +behavior: :variable:`Matlab_ROOT_DIR` the root of the Matlab installation. @@ -184,7 +184,7 @@ Known issues **Symbol clash in a MEX target** By default, every symbols inside a MEX file defined with the command :command:`matlab_add_mex` have hidden - visibility, except for the entry point. This is the default behaviour of + visibility, except for the entry point. This is the default behavior of the MEX compiler, which lowers the risk of symbol collision between the libraries shipped with Matlab, and the libraries to which the MEX file is linking to. This is also the default on Windows platforms. @@ -223,7 +223,7 @@ Reference .. variable:: MATLAB_ADDITIONAL_VERSIONS If set, specifies additional versions of Matlab that may be looked for. - The variable should be a list of strings, organised by pairs of release + The variable should be a list of strings, organized by pairs of release name and versions, such as follows:: set(MATLAB_ADDITIONAL_VERSIONS @@ -856,7 +856,7 @@ endfunction() where ``matlab_file_name`` is the ``UNITTEST_FILE`` without the extension. ``UNITTEST_PRECOMMAND`` Matlab script command to be ran before the file - containing the test (eg. GPU device initialisation based on CMake + containing the test (eg. GPU device initialization based on CMake variables). ``TIMEOUT`` the test timeout in seconds. Defaults to 180 seconds as the @@ -1240,7 +1240,7 @@ function(_Matlab_get_version_from_root matlab_root matlab_or_mcr matlab_known_ve endif() endif() - # UNKNOWN is the default behaviour in case we + # UNKNOWN is the default behavior in case we # - have an erroneous matlab_root # - have an initial 'UNKNOWN' if(matlab_or_mcr STREQUAL "MATLAB" OR matlab_or_mcr STREQUAL "UNKNOWN") @@ -1375,7 +1375,7 @@ function(_Matlab_find_instances_osx matlab_roots) set(_matlab_possible_roots) # on mac, we look for the /Application paths - # this corresponds to the behaviour on Windows. On Linux, we do not have + # this corresponds to the behavior on Windows. On Linux, we do not have # any other guess. matlab_get_supported_releases(_matlab_releases) if(MATLAB_FIND_DEBUG) @@ -1416,7 +1416,7 @@ function(_Matlab_find_instances_from_path matlab_roots) set(_matlab_possible_roots) # At this point, we have no other choice than trying to find it from PATH. - # If set by the user, this wont change + # If set by the user, this won't change. find_program( _matlab_main_tmp NAMES matlab) @@ -1552,7 +1552,7 @@ if(_numbers_of_matlab_roots GREATER 0) # adding a warning in case of ambiguity if(_numbers_of_matlab_roots GREATER 3 AND MATLAB_FIND_DEBUG) message(WARNING "[MATLAB] Found several distributions of Matlab. Setting the current version to ${Matlab_VERSION_STRING} (located ${Matlab_ROOT_DIR})." - " If this is not the desired behaviour, use the EXACT keyword or provide the -DMatlab_ROOT_DIR=... on the command line") + " If this is not the desired behavior, use the EXACT keyword or provide the -DMatlab_ROOT_DIR=... on the command line") endif() endif() endif() diff --git a/Modules/FindMsys.cmake b/Modules/FindMsys.cmake new file mode 100644 index 0000000..b4796d2 --- /dev/null +++ b/Modules/FindMsys.cmake @@ -0,0 +1,31 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindMsys +-------- + +.. versionadded:: 3.21 + +Find MSYS, a POSIX-compatible environment that runs natively +on Microsoft Windows +#]=======================================================================] + +if (WIN32) + if(MSYS_INSTALL_PATH) + set(MSYS_CMD "${MSYS_INSTALL_PATH}/msys2_shell.cmd") + endif() + + find_program(MSYS_CMD + NAMES msys2_shell.cmd + PATHS + "C:/msys64" + "C:/msys32" + "C:/MSYS" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MSYS\\setup;rootdir]" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygnus Solutions\\MSYS\\mounts v2\\/;native]" + ) + get_filename_component(MSYS_INSTALL_PATH "${MSYS_CMD}" DIRECTORY) + mark_as_advanced(MSYS_CMD) + +endif () diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 52330a4..e982e2d 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -130,6 +130,8 @@ function(_OPENMP_FLAG_CANDIDATES LANG) set(OMP_FLAG_XL "-qsmp=omp") # Cray compiler activate OpenMP with -h omp, which is enabled by default. set(OMP_FLAG_Cray " " "-h omp") + set(OMP_FLAG_Fujitsu "-Kopenmp" "-KOMP") + set(OMP_FLAG_FujitsuClang "-fopenmp" "-Kopenmp") # If we know the correct flags, use those if(DEFINED OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID}) diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake index c14e059..26962df 100644 --- a/Modules/FindPerl.cmake +++ b/Modules/FindPerl.cmake @@ -17,9 +17,11 @@ this module looks for Perl #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindMsys.cmake) set(PERL_POSSIBLE_BIN_PATHS ${CYGWIN_INSTALL_PATH}/bin + ${MSYS_INSTALL_PATH}/usr/bin ) if(WIN32) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 4b1e336..c73a2d8 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -140,7 +140,7 @@ Example: function(protobuf_generate) set(_options APPEND_PATH DESCRIPTORS) - set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR) + set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN) if(COMMAND target_sources) list(APPEND _singleargs TARGET) endif() @@ -171,6 +171,10 @@ function(protobuf_generate) set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:") endif() + if(protobuf_generate_PLUGIN) + set(_plugin "--plugin=${protobuf_generate_PLUGIN}") + endif() + if(NOT protobuf_generate_GENERATE_EXTENSIONS) if(protobuf_generate_LANGUAGE STREQUAL cpp) set(protobuf_generate_GENERATE_EXTENSIONS .pb.h .pb.cc) @@ -245,7 +249,7 @@ function(protobuf_generate) add_custom_command( OUTPUT ${_generated_srcs} COMMAND protobuf::protoc - ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file} + ARGS --${protobuf_generate_LANGUAGE}_out ${_dll_export_decl}${protobuf_generate_PROTOC_OUT_DIR} ${_plugin} ${_dll_desc_out} ${_protobuf_include_path} ${_abs_file} DEPENDS ${_abs_file} protobuf::protoc COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}" VERBATIM ) diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index ee07f83..759f57c 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -435,7 +435,7 @@ endif() # Determine the list of possible names for the ruby library -set(_Ruby_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_Ruby_VERSION_SHORT} ruby${_Ruby_VERSION_SHORT_NODOT} ruby-${_Ruby_VERSION_SHORT} ruby-${Ruby_VERSION}) +set(_Ruby_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_Ruby_VERSION_SHORT} ruby${_Ruby_VERSION_SHORT_NODOT} ruby${_Ruby_NODOT_VERSION} ruby-${_Ruby_VERSION_SHORT} ruby-${Ruby_VERSION}) if(WIN32) set(_Ruby_POSSIBLE_MSVC_RUNTIMES "msvcrt;vcruntime140;vcruntime140_1") diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake index 4c7ad89..7c610d9 100644 --- a/Modules/FindSWIG.cmake +++ b/Modules/FindSWIG.cmake @@ -87,56 +87,68 @@ if (NOT _SWIG_NAMES) endif() find_program(SWIG_EXECUTABLE NAMES ${_SWIG_NAMES} swig) +unset(_SWIG_NAMES) -if(SWIG_EXECUTABLE) - execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib - OUTPUT_VARIABLE SWIG_swiglib_output - ERROR_VARIABLE SWIG_swiglib_error - RESULT_VARIABLE SWIG_swiglib_result) +if(SWIG_EXECUTABLE AND NOT SWIG_DIR) + # Find default value for SWIG library directory + execute_process(COMMAND "${SWIG_EXECUTABLE}" -swiglib + OUTPUT_VARIABLE _swig_output + ERROR_VARIABLE _swig_error + RESULT_VARIABLE _swig_result) - if(SWIG_swiglib_result) + if(_swig_result) + set(_msg "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${_swig_error}") if(SWIG_FIND_REQUIRED) - message(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}") + message(SEND_ERROR "${_msg}") else() - message(STATUS "Command \"${SWIG_EXECUTABLE} -swiglib\" failed with output:\n${SWIG_swiglib_error}") + message(STATUS "${_msg}") endif() + unset(_msg) else() - string(REGEX REPLACE "[\n\r]+" ";" SWIG_swiglib_output ${SWIG_swiglib_output}) - find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output} NO_CMAKE_FIND_ROOT_PATH) - if(SWIG_DIR) - set(SWIG_USE_FILE ${CMAKE_CURRENT_LIST_DIR}/UseSWIG.cmake) - execute_process(COMMAND ${SWIG_EXECUTABLE} -version - OUTPUT_VARIABLE SWIG_version_output - ERROR_VARIABLE SWIG_version_output - RESULT_VARIABLE SWIG_version_result) - if(SWIG_version_result) - message(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -version\" failed with output:\n${SWIG_version_output}") - else() - string(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1" - SWIG_version_output "${SWIG_version_output}") - set(SWIG_VERSION ${SWIG_version_output} CACHE STRING "Swig version" FORCE) - endif() - endif() + string(REGEX REPLACE "[\n\r]+" ";" _SWIG_LIB ${_swig_output}) endif() - if(SWIG_FIND_COMPONENTS) - execute_process(COMMAND ${SWIG_EXECUTABLE} -help - OUTPUT_VARIABLE SWIG_swighelp_output - ERROR_VARIABLE SWIG_swighelp_error - RESULT_VARIABLE SWIG_swighelp_result) - if(SWIG_swighelp_result) - message(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -help\" failed with output:\n${SWIG_swiglib_error}") - else() - string(REPLACE "\n" ";" SWIG_swighelp_output "${SWIG_swighelp_output}") - foreach(SWIG_line IN LISTS SWIG_swighelp_output) - if(SWIG_line MATCHES "-([A-Za-z0-9_]+) +- *Generate.*wrappers") - set(SWIG_${CMAKE_MATCH_1}_FOUND TRUE) - endif() - endforeach() - endif() + # Find SWIG library directory + find_path(SWIG_DIR swig.swg PATHS ${_SWIG_LIB} NO_CMAKE_FIND_ROOT_PATH) + unset(_SWIG_LIB) +endif() + +if(SWIG_EXECUTABLE AND SWIG_DIR AND NOT SWIG_VERSION) + # Determine SWIG version + execute_process(COMMAND "${SWIG_EXECUTABLE}" -version + OUTPUT_VARIABLE _swig_output + ERROR_VARIABLE _swig_output + RESULT_VARIABLE _swig_result) + if(_swig_result) + message(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -version\" failed with output:\n${_swig_output}") + else() + string(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1" + _swig_output "${_swig_output}") + set(SWIG_VERSION ${_swig_output} CACHE STRING "Swig version" FORCE) + endif() +endif() + +if(SWIG_EXECUTABLE AND SWIG_FIND_COMPONENTS) + execute_process(COMMAND "${SWIG_EXECUTABLE}" -help + OUTPUT_VARIABLE _swig_output + ERROR_VARIABLE _swig_error + RESULT_VARIABLE _swig_result) + if(_swig_result) + message(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -help\" failed with output:\n${_swig_error}") + else() + string(REPLACE "\n" ";" _swig_output "${_swig_output}") + foreach(SWIG_line IN LISTS _swig_output) + if(SWIG_line MATCHES "-([A-Za-z0-9_]+) +- *Generate.*wrappers") + set(SWIG_${CMAKE_MATCH_1}_FOUND TRUE) + endif() + endforeach() endif() endif() +unset(_swig_output) +unset(_swig_error) +unset(_swig_result) + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args( SWIG HANDLE_COMPONENTS @@ -144,4 +156,8 @@ find_package_handle_standard_args( VERSION_VAR SWIG_VERSION HANDLE_VERSION_RANGE) +if(SWIG_FOUND) + set(SWIG_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseSWIG.cmake") +endif() + mark_as_advanced(SWIG_DIR SWIG_VERSION SWIG_EXECUTABLE) diff --git a/Modules/FindSelfPackers.cmake b/Modules/FindSelfPackers.cmake index 1abbcbd..a6eb6e5 100644 --- a/Modules/FindSelfPackers.cmake +++ b/Modules/FindSelfPackers.cmake @@ -17,15 +17,18 @@ executables or shared libs. Examples: #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindMsys.cmake) find_program(SELF_PACKER_FOR_EXECUTABLE upx ${CYGWIN_INSTALL_PATH}/bin + ${MSYS_INSTALL_PATH}/usr/bin ) find_program(SELF_PACKER_FOR_SHARED_LIB upx ${CYGWIN_INSTALL_PATH}/bin + ${MSYS_INSTALL_PATH}/usr/bin ) mark_as_advanced( diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 87e88bc..c6a3451 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -119,7 +119,10 @@ macro(_check_pthreads_flag) ${CMAKE_BINARY_DIR} ${_threads_src} CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread - OUTPUT_VARIABLE OUTPUT) + OUTPUT_VARIABLE _cmake_check_pthreads_output) + + string(APPEND _cmake_find_threads_output "${_cmake_check_pthreads_output}") + unset(_cmake_check_pthreads_output) unset(_threads_src) if(THREADS_HAVE_PTHREAD_ARG) @@ -127,9 +130,6 @@ macro(_check_pthreads_flag) message(CHECK_PASS "yes") else() message(CHECK_FAIL "no") - file(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if compiler accepts -pthread failed with the following output:\n${OUTPUT}\n\n") endif() endif() @@ -225,7 +225,7 @@ if(CMAKE_USE_PTHREADS_INIT) set(CMAKE_THREAD_LIBS_INIT ) endif() - if(CMAKE_SYSTEM MATCHES "CYGWIN_NT") + if(CMAKE_SYSTEM MATCHES "CYGWIN_NT" OR CMAKE_SYSTEM MATCHES "MSYS_NT") set(CMAKE_USE_PTHREADS_INIT 1) set(Threads_FOUND TRUE) set(CMAKE_THREAD_LIBS_INIT ) @@ -249,4 +249,10 @@ if(THREADS_FOUND AND NOT TARGET Threads::Threads) if(CMAKE_THREAD_LIBS_INIT) set_property(TARGET Threads::Threads PROPERTY INTERFACE_LINK_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") endif() +elseif(NOT THREADS_FOUND AND _cmake_find_threads_output) + file(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if compiler accepts -pthread failed with the following output:\n${_cmake_find_threads_output}\n\n") endif() + +unset(_cmake_find_threads_output) diff --git a/Modules/FindUnixCommands.cmake b/Modules/FindUnixCommands.cmake index 2513f5c..97739fa 100644 --- a/Modules/FindUnixCommands.cmake +++ b/Modules/FindUnixCommands.cmake @@ -13,10 +13,12 @@ This module looks for the Unix commands ``bash``, ``cp``, ``gzip``, #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindMsys.cmake) find_program(BASH bash ${CYGWIN_INSTALL_PATH}/bin + ${MSYS_INSTALL_PATH}/usr/bin ) mark_as_advanced( BASH @@ -25,6 +27,7 @@ mark_as_advanced( find_program(CP cp ${CYGWIN_INSTALL_PATH}/bin + ${MSYS_INSTALL_PATH}/usr/bin ) mark_as_advanced( CP @@ -33,6 +36,7 @@ mark_as_advanced( find_program(GZIP gzip ${CYGWIN_INSTALL_PATH}/bin + ${MSYS_INSTALL_PATH}/usr/bin ) mark_as_advanced( GZIP @@ -41,6 +45,7 @@ mark_as_advanced( find_program(MV mv ${CYGWIN_INSTALL_PATH}/bin + ${MSYS_INSTALL_PATH}/usr/bin ) mark_as_advanced( MV @@ -49,6 +54,7 @@ mark_as_advanced( find_program(RM rm ${CYGWIN_INSTALL_PATH}/bin + ${MSYS_INSTALL_PATH}/usr/bin ) mark_as_advanced( RM @@ -60,6 +66,7 @@ find_program(TAR gtar PATH ${CYGWIN_INSTALL_PATH}/bin + ${MSYS_INSTALL_PATH}/usr/bin ) mark_as_advanced( TAR diff --git a/Modules/FindWget.cmake b/Modules/FindWget.cmake index bd01ec2..d0b6fdf 100644 --- a/Modules/FindWget.cmake +++ b/Modules/FindWget.cmake @@ -16,10 +16,12 @@ This module looks for wget. This module defines the following values: #]=======================================================================] include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindMsys.cmake) find_program(WGET_EXECUTABLE wget ${CYGWIN_INSTALL_PATH}/bin + ${MSYS_INSTALL_PATH}/usr/bin ) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index 998faf1..9e5726b 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -6,14 +6,17 @@ configure_file(${FortranCInterface_SOURCE_DIR}/Input.cmake.in # Detect the Fortran/C interface on the first run or when the # configuration changes. -if(${FortranCInterface_BINARY_DIR}/Input.cmake - IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake - OR ${FortranCInterface_SOURCE_DIR}/Output.cmake.in - IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake - OR ${FortranCInterface_SOURCE_DIR}/CMakeLists.txt - IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake - OR ${CMAKE_CURRENT_LIST_FILE} - IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake +if(NOT EXISTS ${FortranCInterface_BINARY_DIR}/Output.cmake + OR NOT EXISTS ${FortranCInterface_BINARY_DIR}/Input.cmake + OR NOT EXISTS ${FortranCInterface_BINARY_DIR}/Output.cmake.in + OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake + IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Input.cmake + OR NOT ${FortranCInterface_SOURCE_DIR}/Output.cmake + IS_NEWER_THAN ${FortranCInterface_BINARY_DIR}/Output.cmake.in + OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake + IS_NEWER_THAN ${FortranCInterface_SOURCE_DIR}/CMakeLists.txt + OR NOT ${FortranCInterface_BINARY_DIR}/Output.cmake + IS_NEWER_THAN ${CMAKE_CURRENT_LIST_FILE} ) message(CHECK_START "Detecting Fortran/C Interface") else() diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index e149f4c..f7d8c36 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -352,7 +352,7 @@ macro(GNUInstallDirs_get_absolute_install_dir absvar var) if(GGAID_extra_arg_count GREATER 0) list(GET GGAID_extra_args 0 GGAID_dir) else() - # Historical behaviour: use ${dir} from caller's scope + # Historical behavior: use ${dir} from caller's scope set(GGAID_dir "${dir}") message(AUTHOR_WARNING "GNUInstallDirs_get_absolute_install_dir called without third argument. " diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index ed5c38b..e90a9b5 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -83,7 +83,7 @@ to 1 all prerequisites will be found recursively, if set to 0 only direct prerequisites are listed. <exclude_system> must be 0 or 1 indicating whether to include or exclude "system" prerequisites. With <verbose> set to 0 only the full path names of the prerequisites are -printed, set to 1 extra informatin will be displayed. +printed, set to 1 extra information will be displayed. :: diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake index 2ea9e74..80d8e23 100644 --- a/Modules/GoogleTest.cmake +++ b/Modules/GoogleTest.cmake @@ -504,7 +504,8 @@ function(gtest_discover_tests TARGET) string(CONCAT ctest_include_content "if(EXISTS \"$<TARGET_FILE:${TARGET}>\")" "\n" - " if(\"$<TARGET_FILE:${TARGET}>\" IS_NEWER_THAN \"${ctest_tests_file}\")" "\n" + " if(NOT EXISTS \"${ctest_tests_file}\" OR" "\n" + " NOT \"${ctest_tests_file}\" IS_NEWER_THAN \"$<TARGET_FILE:${TARGET}>\")" "\n" " include(\"${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}\")" "\n" " gtest_discover_tests_impl(" "\n" " TEST_EXECUTABLE" " [==[" "$<TARGET_FILE:${TARGET}>" "]==]" "\n" diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake index 08bbc68..bece2dd 100644 --- a/Modules/Internal/CPack/CPackRPM.cmake +++ b/Modules/Internal/CPack/CPackRPM.cmake @@ -6,6 +6,56 @@ cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) # if IN_LIST +function(set_spec_script_if_enabled TYPE PACKAGE_NAME VAR) + if(NOT "${VAR}" STREQUAL "" AND NOT "${VAR}" STREQUAL "\n") + if(PACKAGE_NAME) + set(PACKAGE_NAME " -n ${PACKAGE_NAME}") + endif() + set(${TYPE}_ + "%${TYPE}${PACKAGE_NAME}\n" + "${VAR}\n" PARENT_SCOPE) + else() + set(${TYPE} "" PARENT_SCOPE) + endif() +endfunction() + +macro(set_spec_scripts PACKAGE_NAME) + # we should only set scripts that were provided + # as script announcement without content inside + # spec file will generate unneeded dependency + # on shell + + set_spec_script_if_enabled( + "post" + "${PACKAGE_NAME}" + "${RPM_SYMLINK_POSTINSTALL}\n${CPACK_RPM_SPEC_POSTINSTALL}") + + set_spec_script_if_enabled( + "posttrans" + "${PACKAGE_NAME}" + "${CPACK_RPM_SPEC_POSTTRANS}") + + set_spec_script_if_enabled( + "postun" + "${PACKAGE_NAME}" + "${CPACK_RPM_SPEC_POSTUNINSTALL}") + + set_spec_script_if_enabled( + "pre" + "${PACKAGE_NAME}" + "${CPACK_RPM_SPEC_PREINSTALL}") + + set_spec_script_if_enabled( + "pretrans" + "${PACKAGE_NAME}" + "${CPACK_RPM_SPEC_PRETRANS}") + + set_spec_script_if_enabled( + "preun" + "${PACKAGE_NAME}" + "${CPACK_RPM_SPEC_PREUNINSTALL}") +endmacro() + function(get_file_permissions FILE RETURN_VAR) execute_process(COMMAND ls -l ${FILE} OUTPUT_VARIABLE permissions_ @@ -1349,15 +1399,21 @@ function(cpack_rpm_generate_package) continue() endif() - file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE + file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES true RELATIVE "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}" "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*") foreach(f_ IN LISTS files_for_move_) - get_filename_component(dir_path_ "${f_}" DIRECTORY) set(src_file_ "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/${f_}") + if(IS_DIRECTORY "${src_file_}") + file(MAKE_DIRECTORY "${WDIR}/${f_}") + continue() + endif() + + get_filename_component(dir_path_ "${f_}" DIRECTORY) + # check that we are not overriding an existing file that doesn't # match the file that we want to copy if(EXISTS "${src_file_}" AND EXISTS "${WDIR}/${f_}") @@ -1607,6 +1663,9 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ ) elseif(GENERATE_SPEC_PARTS) # binary rpm with single debuginfo package + + set_spec_scripts("${CPACK_RPM_PACKAGE_NAME}") + file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in "# -*- rpm-spec -*- %package -n \@CPACK_RPM_PACKAGE_NAME\@ @@ -1637,6 +1696,13 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ %description -n \@CPACK_RPM_PACKAGE_NAME\@ \@CPACK_RPM_PACKAGE_DESCRIPTION\@ +\@post_\@ +\@posttrans_\@ +\@postun_\@ +\@pre_\@ +\@pretrans_\@ +\@preun_\@ + %files -n \@CPACK_RPM_PACKAGE_NAME\@ %defattr(\@TMP_DEFAULT_FILE_PERMISSIONS\@,\@TMP_DEFAULT_USER\@,\@TMP_DEFAULT_GROUP\@,\@TMP_DEFAULT_DIR_PERMISSIONS\@) \@CPACK_RPM_INSTALL_FILES\@ @@ -1662,6 +1728,8 @@ Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ set(RPMBUILD_FLAGS "-bb") if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) + set_spec_scripts("") + file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in "# Restore old style debuginfo creation for rpm >= 4.14. %undefine _debugsource_packages @@ -1725,24 +1793,12 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT %clean -%post -\@RPM_SYMLINK_POSTINSTALL\@ -\@CPACK_RPM_SPEC_POSTINSTALL\@ - -%posttrans -\@CPACK_RPM_SPEC_POSTTRANS\@ - -%postun -\@CPACK_RPM_SPEC_POSTUNINSTALL\@ - -%pre -\@CPACK_RPM_SPEC_PREINSTALL\@ - -%pretrans -\@CPACK_RPM_SPEC_PRETRANS\@ - -%preun -\@CPACK_RPM_SPEC_PREUNINSTALL\@ +\@post_\@ +\@posttrans_\@ +\@postun_\@ +\@pre_\@ +\@pretrans_\@ +\@preun_\@ %files %defattr(\@TMP_DEFAULT_FILE_PERMISSIONS\@,\@TMP_DEFAULT_USER\@,\@TMP_DEFAULT_GROUP\@,\@TMP_DEFAULT_DIR_PERMISSIONS\@) diff --git a/Modules/Internal/CPack/NSIS.template.in b/Modules/Internal/CPack/NSIS.template.in index e6439ad..0a9c487 100644 --- a/Modules/Internal/CPack/NSIS.template.in +++ b/Modules/Internal/CPack/NSIS.template.in @@ -919,8 +919,8 @@ Function .onInit ;Run the uninstaller uninst: ClearErrors - StrLen $2 "\Uninstall.exe" - StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path + StrLen $2 "\@CPACK_NSIS_UNINSTALL_NAME@.exe" + StrCpy $3 $0 -$2 # remove "\@CPACK_NSIS_UNINSTALL_NAME@.exe" from UninstallString to get path ExecWait '"$0" /S _?=$3' ;Do not copy the uninstaller to a temp file IfErrors uninst_failed inst diff --git a/Modules/Platform/ARTOS-GNU-C.cmake b/Modules/Platform/ARTOS-GNU-C.cmake index fe8d782..bce4613 100644 --- a/Modules/Platform/ARTOS-GNU-C.cmake +++ b/Modules/Platform/ARTOS-GNU-C.cmake @@ -1,4 +1,4 @@ -# Define ARTOS to select proper behaviour and tell preprocessor to accept C++ style comments. +# Define ARTOS to select proper behavior and tell preprocessor to accept C++ style comments. string(APPEND CMAKE_C_FLAGS_INIT " -DARTOS -Xp -+") # ac doesn't support -g properly and doesn't support the normal gcc optimization options. Just use the defaults set by ac. string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ") diff --git a/Modules/Platform/Apple-NVIDIA-CUDA.cmake b/Modules/Platform/Apple-NVIDIA-CUDA.cmake index bec3948..35e759a 100644 --- a/Modules/Platform/Apple-NVIDIA-CUDA.cmake +++ b/Modules/Platform/Apple-NVIDIA-CUDA.cmake @@ -1,19 +1,19 @@ include(Platform/Darwin) -set(__IMPLICT_LINKS ) +set(__IMPLICIT_LINKS) foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}) - string(APPEND __IMPLICT_LINKS " -L\"${dir}\"") + string(APPEND __IMPLICIT_LINKS " -L\"${dir}\"") endforeach() foreach(lib ${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES}) if(${lib} MATCHES "/") - string(APPEND __IMPLICT_LINKS " \"${lib}\"") + string(APPEND __IMPLICIT_LINKS " \"${lib}\"") else() - string(APPEND __IMPLICT_LINKS " -l${lib}") + string(APPEND __IMPLICIT_LINKS " -l${lib}") endif() endforeach() set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS "-shared -Wl,-headerpad_max_install_names") set(CMAKE_SHARED_MODULE_CREATE_CUDA_FLAGS "-shared -Wl,-headerpad_max_install_names") -set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}") -set(CMAKE_CUDA_CREATE_SHARED_MODULE "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}") +set(CMAKE_CUDA_CREATE_SHARED_LIBRARY "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> -o <TARGET> <SONAME_FLAG> <TARGET_INSTALLNAME_DIR><TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>${__IMPLICIT_LINKS}") +set(CMAKE_CUDA_CREATE_SHARED_MODULE "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICIT_LINKS}") diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake index 4fa14ce..b81bd4d 100644 --- a/Modules/Platform/CYGWIN-GNU.cmake +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -10,7 +10,6 @@ set(__CYGWIN_COMPILER_GNU 1) # TODO: Is -Wl,--enable-auto-import now always default? string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -Wl,--enable-auto-import") -set(CMAKE_CREATE_WIN32_EXE "-mwindows") set(CMAKE_GNULD_IMAGE_VERSION "-Wl,--major-image-version,<TARGET_VERSION_MAJOR>,--minor-image-version,<TARGET_VERSION_MINOR>") @@ -23,6 +22,7 @@ macro(__cygwin_compiler_gnu lang) "<CMAKE_${lang}_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") + set(CMAKE_${lang}_CREATE_WIN32_EXE "-mwindows") # No -fPIC on cygwin set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "") diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index 9b897bd..fc4ea2e 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -1,7 +1,7 @@ -if("${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS "2.8.3.20101214") +if("${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS "2.8.3.20101214" AND NOT MSYS) set(__USE_CMAKE_LEGACY_CYGWIN_WIN32 1) endif() -if(NOT DEFINED WIN32) +if(NOT DEFINED WIN32 AND NOT MSYS) set(WIN32 0) if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32) if(NOT DEFINED CMAKE_LEGACY_CYGWIN_WIN32 diff --git a/Modules/Platform/Linux-Fujitsu-C.cmake b/Modules/Platform/Linux-Fujitsu-C.cmake new file mode 100644 index 0000000..e37573d --- /dev/null +++ b/Modules/Platform/Linux-Fujitsu-C.cmake @@ -0,0 +1 @@ +include(Platform/Linux-Clang-C) diff --git a/Modules/Platform/Linux-Fujitsu-CXX.cmake b/Modules/Platform/Linux-Fujitsu-CXX.cmake new file mode 100644 index 0000000..5257f13 --- /dev/null +++ b/Modules/Platform/Linux-Fujitsu-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Linux-Clang-CXX) diff --git a/Modules/Platform/Linux-Fujitsu.cmake b/Modules/Platform/Linux-Fujitsu.cmake new file mode 100644 index 0000000..be11b0a --- /dev/null +++ b/Modules/Platform/Linux-Fujitsu.cmake @@ -0,0 +1,17 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +if(__LINUX_COMPILER_FUJITSU) + return() +endif() +set(__LINUX_COMPILER_FUJITSU 1) + +macro(__linux_compiler_fujitsu lang) + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE") + set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=") + set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") +endmacro() diff --git a/Modules/Platform/MSYS-Clang-C.cmake b/Modules/Platform/MSYS-Clang-C.cmake new file mode 100644 index 0000000..f025b33 --- /dev/null +++ b/Modules/Platform/MSYS-Clang-C.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-Clang-C) diff --git a/Modules/Platform/MSYS-Clang-CXX.cmake b/Modules/Platform/MSYS-Clang-CXX.cmake new file mode 100644 index 0000000..e509eaa --- /dev/null +++ b/Modules/Platform/MSYS-Clang-CXX.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-Clang-CXX) diff --git a/Modules/Platform/MSYS-Determine-CXX.cmake b/Modules/Platform/MSYS-Determine-CXX.cmake new file mode 100644 index 0000000..dec17f0 --- /dev/null +++ b/Modules/Platform/MSYS-Determine-CXX.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-Determine-CXX) diff --git a/Modules/Platform/MSYS-GNU-C.cmake b/Modules/Platform/MSYS-GNU-C.cmake new file mode 100644 index 0000000..e8343a4 --- /dev/null +++ b/Modules/Platform/MSYS-GNU-C.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-GNU-C) diff --git a/Modules/Platform/MSYS-GNU-CXX.cmake b/Modules/Platform/MSYS-GNU-CXX.cmake new file mode 100644 index 0000000..67775de --- /dev/null +++ b/Modules/Platform/MSYS-GNU-CXX.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-GNU-CXX) diff --git a/Modules/Platform/MSYS-GNU-Fortran.cmake b/Modules/Platform/MSYS-GNU-Fortran.cmake new file mode 100644 index 0000000..b0b7d8e --- /dev/null +++ b/Modules/Platform/MSYS-GNU-Fortran.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-GNU-Fortran) diff --git a/Modules/Platform/MSYS-GNU.cmake b/Modules/Platform/MSYS-GNU.cmake new file mode 100644 index 0000000..012c112 --- /dev/null +++ b/Modules/Platform/MSYS-GNU.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-GNU) diff --git a/Modules/Platform/MSYS-windres.cmake b/Modules/Platform/MSYS-windres.cmake new file mode 100644 index 0000000..faaccc2 --- /dev/null +++ b/Modules/Platform/MSYS-windres.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-windres) diff --git a/Modules/Platform/MSYS.cmake b/Modules/Platform/MSYS.cmake new file mode 100644 index 0000000..96fa36f --- /dev/null +++ b/Modules/Platform/MSYS.cmake @@ -0,0 +1,4 @@ +set(MSYS 1) +include(Platform/CYGWIN) +set(CMAKE_SHARED_LIBRARY_PREFIX "msys-") +set(CMAKE_SHARED_MODULE_PREFIX "msys-") diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index c508ac1..373be76 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -57,8 +57,8 @@ macro(__windows_compiler_clang_gnu lang) set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto") set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES) set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) - set(CMAKE_${lang}_ARCHIVE_CREATE_IPO "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>") - set(CMAKE_${lang}_ARCHIVE_APPEND_IPO "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_${lang}_ARCHIVE_CREATE_IPO "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>") + set(CMAKE_${lang}_ARCHIVE_APPEND_IPO "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_ARCHIVE_FINISH_IPO "<CMAKE_RANLIB> <TARGET>") # Create archiving rules to support large object file lists for static libraries. @@ -71,8 +71,8 @@ macro(__windows_compiler_clang_gnu lang) set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_${lang}_COMPILER> -fuse-ld=lld-link -nostartfiles -nostdlib <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Xlinker /implib:<TARGET_IMPLIB> -Xlinker /pdb:<TARGET_PDB> -Xlinker /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") - set(CMAKE_CREATE_WIN32_EXE "-Xlinker /subsystem:windows") - set(CMAKE_CREATE_CONSOLE_EXE "-Xlinker /subsystem:console") + set(CMAKE_${lang}_CREATE_WIN32_EXE "-Xlinker /subsystem:windows") + set(CMAKE_${lang}_CREATE_CONSOLE_EXE "-Xlinker /subsystem:console") if(NOT "${lang}" STREQUAL "ASM") set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -Xclang -flto-visibility-public-std -D_MT -Xclang --dependent-lib=libcmt) diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake index 8f1d024..4ecc2c2 100644 --- a/Modules/Platform/Windows-Embarcadero.cmake +++ b/Modules/Platform/Windows-Embarcadero.cmake @@ -51,11 +51,6 @@ set(CMAKE_FIND_LIBRARY_SUFFIXES "-bcc.lib" ".lib") # Borland cannot handle + in the file name, so mangle object file name set (CMAKE_MANGLE_OBJECT_FILE_NAMES "ON") -# extra flags for a win32 exe -set(CMAKE_CREATE_WIN32_EXE "${_tW}" ) -# extra flags for a console app -set(CMAKE_CREATE_CONSOLE_EXE "${_tC}" ) - set (CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.") @@ -124,6 +119,9 @@ macro(__embarcadero_language lang) "tlib ${CMAKE_START_TEMP_FILE}/p512 <LINK_FLAGS> /a <TARGET_QUOTED> <OBJECTS>${CMAKE_END_TEMP_FILE}" ) + set(CMAKE_${lang}_CREATE_WIN32_EXE "${_tW}") + set(CMAKE_${lang}_CREATE_CONSOLE_EXE "${_tC}") + # Precompile Headers if (EMBARCADERO) set(CMAKE_PCH_EXTENSION .pch) diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index a2e3811..d000380 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -35,7 +35,6 @@ set(CMAKE_LIBRARY_PATH_FLAG "-L") set(CMAKE_LINK_LIBRARY_FLAG "-l") set(CMAKE_LINK_DEF_FILE_FLAG "") # Empty string: passing the file is enough set(CMAKE_LINK_LIBRARY_SUFFIX "") -set(CMAKE_CREATE_WIN32_EXE "-mwindows") set(CMAKE_GNULD_IMAGE_VERSION "-Wl,--major-image-version,<TARGET_VERSION_MAJOR>,--minor-image-version,<TARGET_VERSION_MINOR>") @@ -105,6 +104,7 @@ macro(__windows_compiler_gnu lang) "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>") set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>") + set(CMAKE_${lang}_CREATE_WIN32_EXE "-mwindows") list(APPEND CMAKE_${lang}_ABI_FILES "Platform/Windows-GNU-${lang}-ABI") @@ -121,7 +121,7 @@ macro(__windows_compiler_gnu lang) CMAKE_${lang}_${rule} "${CMAKE_${lang}_${rule}}") set(CMAKE_${lang}_${rule} "<CMAKE_COMMAND> -E rm -f <OBJECT_DIR>/objects.a" - "<CMAKE_AR> cr <OBJECT_DIR>/objects.a <OBJECTS>" + "<CMAKE_AR> qc <OBJECT_DIR>/objects.a <OBJECTS>" "${CMAKE_${lang}_${rule}}" ) endforeach() diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index e384af4..4223bde 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -27,12 +27,8 @@ else() endif() if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE") - set(CMAKE_CREATE_WIN32_EXE "/entry:WinMainCRTStartup") - set(CMAKE_CREATE_CONSOLE_EXE "/entry:mainACRTStartup") set(_PLATFORM_LINK_FLAGS " /subsystem:windowsce") else() - set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows") - set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console") set(_PLATFORM_LINK_FLAGS "") endif() @@ -351,6 +347,14 @@ 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}") + if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE") + set(CMAKE_${lang}_CREATE_WIN32_EXE "/entry:WinMainCRTStartup") + set(CMAKE_${lang}_CREATE_CONSOLE_EXE "/entry:mainACRTStartup") + else() + set(CMAKE_${lang}_CREATE_WIN32_EXE "/subsystem:windows") + set(CMAKE_${lang}_CREATE_CONSOLE_EXE "/subsystem:console") + endif() + set(CMAKE_PCH_EXTENSION .pch) set(CMAKE_LINK_PCH ON) if (CMAKE_${lang}_COMPILER_ID STREQUAL "Clang") diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake index a88f4bc..b83932e 100644 --- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake +++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake @@ -7,49 +7,49 @@ set(CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION set(CMAKE_CUDA_COMPILE_WHOLE_COMPILATION "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c <SOURCE> -o <OBJECT> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS") -set(__IMPLICT_LINKS ) +set(__IMPLICIT_LINKS) foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}) - string(APPEND __IMPLICT_LINKS " -LIBPATH:\"${dir}\"") + string(APPEND __IMPLICIT_LINKS " -LIBPATH:\"${dir}\"") endforeach() foreach(lib ${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES}) - string(APPEND __IMPLICT_LINKS " \"${lib}\"") + string(APPEND __IMPLICIT_LINKS " \"${lib}\"") endforeach() set(CMAKE_CUDA_LINK_EXECUTABLE - "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <LINK_FLAGS> <OBJECTS> /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_LIBRARIES>${__IMPLICT_LINKS}") + "<CMAKE_CUDA_HOST_LINK_LAUNCHER> <LINK_FLAGS> <OBJECTS> /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_LIBRARIES>${__IMPLICIT_LINKS}") set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll --intdir=<OBJECT_DIR> --rc=<CMAKE_RC_COMPILER> --mt=<CMAKE_MT> --manifests <MANIFESTS> -- ") set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe --intdir=<OBJECT_DIR> --rc=<CMAKE_RC_COMPILER> --mt=<CMAKE_MT> --manifests <MANIFESTS> -- ") set(CMAKE_CUDA_CREATE_SHARED_LIBRARY - "${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES>${__IMPLICT_LINKS} ${CMAKE_END_TEMP_FILE}") + "${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES>${__IMPLICIT_LINKS} ${CMAKE_END_TEMP_FILE}") set(CMAKE_CUDA_CREATE_SHARED_MODULE ${CMAKE_CUDA_CREATE_SHARED_LIBRARY}) set(CMAKE_CUDA_CREATE_STATIC_LIBRARY "<CMAKE_AR> ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ") set(CMAKE_CUDA_LINKER_SUPPORTS_PDB ON) set(CMAKE_CUDA_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} <LINK_FLAGS> <LINK_LIBRARIES>${__IMPLICT_LINKS} ${CMAKE_END_TEMP_FILE}") -unset(_CMAKE_VS_LINK_EXE) + "${_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} <LINK_FLAGS> <LINK_LIBRARIES>${__IMPLICIT_LINKS} ${CMAKE_END_TEMP_FILE}") +unset(_CMAKE_VS_LINK_DLL) unset(_CMAKE_VS_LINK_EXE) # Add implicit host link directories that contain device libraries # to the device link line. -set(__IMPLICT_DLINK_DIRS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) -if(__IMPLICT_DLINK_DIRS) - list(REMOVE_ITEM __IMPLICT_DLINK_DIRS ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}) +set(__IMPLICIT_DLINK_DIRS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) +if(__IMPLICIT_DLINK_DIRS) + list(REMOVE_ITEM __IMPLICIT_DLINK_DIRS ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES}) endif() -set(__IMPLICT_DLINK_FLAGS ) -foreach(dir ${__IMPLICT_DLINK_DIRS}) +set(__IMPLICIT_DLINK_FLAGS) +foreach(dir ${__IMPLICIT_DLINK_DIRS}) if(EXISTS "${dir}/curand_static.lib") - string(APPEND __IMPLICT_DLINK_FLAGS " -L\"${dir}\"") + string(APPEND __IMPLICIT_DLINK_FLAGS " -L\"${dir}\"") endif() endforeach() -unset(__IMPLICT_DLINK_DIRS) +unset(__IMPLICIT_DLINK_DIRS) set(CMAKE_CUDA_DEVICE_LINK_LIBRARY - "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}") + "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICIT_DLINK_FLAGS}") set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE - "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICT_DLINK_FLAGS}") -unset(__IMPLICT_DLINK_FLAGS) + "<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS${__IMPLICIT_DLINK_FLAGS}") +unset(__IMPLICIT_DLINK_FLAGS) string(REPLACE "/D" "-D" _PLATFORM_DEFINES_CUDA "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_CXX}") @@ -69,14 +69,6 @@ else() endif() unset(_cmp0092) -set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "cudadevrt;cudart_static") -set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_SHARED "cudadevrt;cudart") -set(CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_NONE "") - -if(UNIX) - list(APPEND CMAKE_CUDA_RUNTIME_LIBRARY_LINK_OPTIONS_STATIC "rt" "pthread" "dl") -endif() - string(APPEND CMAKE_CUDA_FLAGS_INIT " ${PLATFORM_DEFINES_CUDA} -D_WINDOWS -Xcompiler=\"${_W3}${_FLAGS_CXX}\"") string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=\"${_MDd}-Zi -Ob0 -Od ${_RTC1}\"") string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -Xcompiler=\"${_MD}-O2 -Ob2\" -DNDEBUG") diff --git a/Modules/Platform/Windows-OpenWatcom-C.cmake b/Modules/Platform/Windows-OpenWatcom-C.cmake index ce9bc45..b82a4cb 100644 --- a/Modules/Platform/Windows-OpenWatcom-C.cmake +++ b/Modules/Platform/Windows-OpenWatcom-C.cmake @@ -1 +1,2 @@ include(Platform/Windows-OpenWatcom) +__windows_open_watcom(C) diff --git a/Modules/Platform/Windows-OpenWatcom-CXX.cmake b/Modules/Platform/Windows-OpenWatcom-CXX.cmake index ce9bc45..ac90d28 100644 --- a/Modules/Platform/Windows-OpenWatcom-CXX.cmake +++ b/Modules/Platform/Windows-OpenWatcom-CXX.cmake @@ -1 +1,2 @@ include(Platform/Windows-OpenWatcom) +__windows_open_watcom(CXX) diff --git a/Modules/Platform/Windows-OpenWatcom.cmake b/Modules/Platform/Windows-OpenWatcom.cmake index 70055da..19bcb97 100644 --- a/Modules/Platform/Windows-OpenWatcom.cmake +++ b/Modules/Platform/Windows-OpenWatcom.cmake @@ -6,8 +6,6 @@ include_guard() set(CMAKE_BUILD_TYPE_INIT Debug) -set(CMAKE_CREATE_WIN32_EXE "system nt_win" ) -set(CMAKE_CREATE_CONSOLE_EXE "system nt" ) string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " system nt_dll") string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " system nt_dll") @@ -30,3 +28,8 @@ if(CMAKE_CROSSCOMPILING) set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES $ENV{WATCOM}/h $ENV{WATCOM}/h/nt) endif() endif() + +macro(__windows_open_watcom lang) + set(CMAKE_${lang}_CREATE_WIN32_EXE "system nt_win") + set(CMAKE_${lang}_CREATE_CONSOLE_EXE "system nt") +endmacro() diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake index 8b824bc..c823423 100644 --- a/Modules/Platform/Windows-df.cmake +++ b/Modules/Platform/Windows-df.cmake @@ -27,8 +27,8 @@ set(CMAKE_Fortran_COMPILE_OBJECT set(CMAKE_Fortran_LINK_EXECUTABLE "<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /exe:<TARGET> <OBJECTS> /link <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") -set(CMAKE_CREATE_WIN32_EXE /winapp) -set(CMAKE_CREATE_CONSOLE_EXE ) +set(CMAKE_Fortran_CREATE_WIN32_EXE /winapp) +set(CMAKE_Fortran_CREATE_CONSOLE_EXE ) # does the compiler support pdbtype and is it the newer compiler diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 6073125..5c8f152 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -38,7 +38,13 @@ Defines the following command for use with ``SWIG``: .. versionchanged:: 3.15 Alternate library name (set with the :prop_tgt:`OUTPUT_NAME` property, - for example) will be passed on to Python and CSharp wrapper libraries. + for example) will be passed on to ``Python`` and ``CSharp`` wrapper + libraries. + + .. versionchanged:: 3.21 + Generated library use standard naming conventions for ``CSharp`` language + when policy :policy:`CMP0122` is set to ``NEW``. Otherwise, the legacy + behavior is applied. .. note:: @@ -185,8 +191,12 @@ ensure generated files will receive the required settings. If set to ``TRUE``, implicit dependencies are generated by the ``swig`` tool itself. This property is only meaningful for - :ref:`Makefile <Makefile Generators>` and - :ref:`Ninja <Ninja Generators>` generators. Default value is ``FALSE``. + :ref:`Makefile <Makefile Generators>`, + :ref:`Ninja <Ninja Generators>` and :generator:`Xcode` generators. Default + value is ``FALSE``. + + .. versionadded:: 3.21 + Added the support of :generator:`Xcode` generator. ``SWIG_MODULE_NAME`` Specify the actual import name of the module in the target language. @@ -330,12 +340,17 @@ as well as ``SWIG``: .. versionadded:: 3.20 If set to ``TRUE``, implicit dependencies are generated by the ``swig`` tool - itself. This property is only meaningful for - :ref:`Makefile <Makefile Generators>` and - :ref:`Ninja <Ninja Generators>` generators. Default value is ``FALSE``. + itself. This variable is only meaningful for + :ref:`Makefile <Makefile Generators>`, + :ref:`Ninja <Ninja Generators>` and :generator:`Xcode` generators. Default + value is ``FALSE``. Source file property ``USE_SWIG_DEPENDENCIES``, if not defined, will be initialized with the value of this variable. + + .. versionadded:: 3.21 + Added the support of :generator:`Xcode` generator. + #]=======================================================================] cmake_policy(PUSH) @@ -500,7 +515,7 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) endif() set (use_swig_dependencies ${SWIG_USE_SWIG_DEPENDENCIES}) - if (CMAKE_GENERATOR MATCHES "Make|Ninja") + if (CMAKE_GENERATOR MATCHES "Make|Ninja|Xcode") get_property(use_swig_dependencies_set SOURCE "${infile}" PROPERTY USE_SWIG_DEPENDENCIES SET) if (use_swig_dependencies_set) get_property(use_swig_dependencies SOURCE "${infile}" PROPERTY USE_SWIG_DEPENDENCIES) @@ -515,7 +530,7 @@ function(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) endif() set (property "$<TARGET_PROPERTY:${target_name},SWIG_INCLUDE_DIRECTORIES>") list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-I$<JOIN:$<TARGET_GENEX_EVAL:${target_name},${property}>,$<SEMICOLON>-I>>") - set (property "$<TARGET_PROPERTY:${target_name},INCLUDE_DIRECTORIES>") + set (property "$<REMOVE_DUPLICATES:$<TARGET_PROPERTY:${target_name},INCLUDE_DIRECTORIES>>") get_source_file_property(use_target_include_dirs "${infile}" USE_TARGET_INCLUDE_DIRECTORIES) if (use_target_include_dirs) list (APPEND swig_source_file_flags "$<$<BOOL:${property}>:-I$<JOIN:${property},$<SEMICOLON>-I>>") @@ -825,7 +840,7 @@ function(SWIG_ADD_LIBRARY name) set(SWIG_SOURCE_FILE_EXTENSIONS ".i") endif() - if (CMAKE_GENERATOR MATCHES "Make|Ninja") + if (CMAKE_GENERATOR MATCHES "Make|Ninja|Xcode") # For Makefiles and Ninja generators, use SWIG generated dependencies if (NOT DEFINED SWIG_USE_SWIG_DEPENDENCIES) set (SWIG_USE_SWIG_DEPENDENCIES OFF) @@ -952,6 +967,17 @@ function(SWIG_ADD_LIBRARY name) endif () elseif (swig_lowercase_language STREQUAL "fortran") # Do *not* override the target's library prefix + elseif (swig_lowercase_language STREQUAL "csharp") + cmake_policy(GET CMP0122 csharp_naming_policy) + if (csharp_naming_policy STREQUAL "NEW") + # Do *not* override the target's library prefix + else() + if (NOT csharp_naming_policy) + cmake_policy(GET_WARNING CMP0122 _cmp0122_warning) + message(AUTHOR_WARNING "${_cmp0122_warning}\n") + endif() + set_target_properties (${target_name} PROPERTIES PREFIX "") + endif() else() # assume empty prefix because we expect the module to be dynamically loaded set_target_properties (${target_name} PROPERTIES PREFIX "") |