diff options
Diffstat (limited to 'Modules')
45 files changed, 379 insertions, 440 deletions
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index 4d0c681..7aac846 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -57,6 +57,7 @@ function(compiler_id_detection outvar lang) HP Compaq zOS + XLClang XL VisualAge PGI @@ -86,8 +87,6 @@ function(compiler_id_detection outvar lang) SDCC ) endif() - list(APPEND ordered_compilers - MIPSpro) #Currently the only CUDA compilers are NVIDIA if(lang STREQUAL CUDA) @@ -98,6 +97,8 @@ function(compiler_id_detection outvar lang) foreach(Id ${ordered_compilers}) string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT "# define ${CID_PREFIX}COMPILER_IS_${Id} 0\n") endforeach() + # Hard-code definitions for compilers that are no longer supported. + string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT "# define ${CID_PREFIX}COMPILER_IS_MIPSpro 0\n") endif() set(pp_if "#if") diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index dbc41c8..b8c8c5d 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -83,7 +83,7 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_XL "XL C") list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS MSVC ) - set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_MSVC "/?") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_MSVC "-?") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_MSVC "Microsoft") list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI ) @@ -110,6 +110,10 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ADSP "-version") set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ADSP "Analog Devices") + list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS QCC) + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_QCC "-V") + set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_QCC "gcc_nto") + include(CMakeDetermineCompilerId) set(userflags) CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT} "${userflags}") diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index d7f6f97..3ec534f 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -139,8 +139,9 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|QCC") get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME) - if (COMPILER_BASENAME MATCHES "^(.+-)(clang|g?cc)(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + if (COMPILER_BASENAME MATCHES "^(.+-)(clang|g?cc)(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_5}) elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") if(CMAKE_C_COMPILER_TARGET) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-) diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index bd878b2..68cb9fe 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -136,8 +136,9 @@ if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX) if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC") get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME) - if (COMPILER_BASENAME MATCHES "^(.+-)(clan)?[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + if (COMPILER_BASENAME MATCHES "^(.+-)(clan)?[gc]\\+\\+(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$") set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_5}) elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") if(CMAKE_CXX_COMPILER_TARGET) set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-) diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index fd1d5fb..e0d2449 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -96,6 +96,12 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Parsed ${lang} implicit include dir info from above output: rv=${rv}\n${log}\n\n") if("${rv}" STREQUAL "done") + # Entries that we have been told to explicitly pass as standard include + # directories will not be implicitly added by the compiler. + if(CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES) + list(REMOVE_ITEM implicit_incdirs ${CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES}) + endif() + # We parsed implicit include directories, so override the default initializer. set(_CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT "${implicit_incdirs}") endif() diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 83ce392..59dab6d 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -181,7 +181,10 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(vs_version ${CMAKE_MATCH_1}) set(id_platform ${CMAKE_VS_PLATFORM_NAME}) set(id_lang "${lang}") - if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") + set(id_PostBuildEvent_Command "") + if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Ll][Ll][Vv][Mm]$") + set(id_cl_var "ClangClExecutable") + elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*") set(id_cl clang.exe) else() set(id_cl cl.exe) @@ -268,7 +271,11 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR}) set(id_src "${src}") set(id_compile "ClCompile") - set(id_PostBuildEvent_Command "for %%i in (${id_cl}) do %40echo CMAKE_${lang}_COMPILER=%%~$PATH:i") + if(id_cl_var) + set(id_PostBuildEvent_Command "echo CMAKE_${lang}_COMPILER=$(${id_cl_var})") + else() + set(id_PostBuildEvent_Command "for %%i in (${id_cl}) do %40echo CMAKE_${lang}_COMPILER=%%~$PATH:i") + endif() set(id_Import_props "") set(id_Import_targets "") set(id_ItemDefinitionGroup_entry "") @@ -824,7 +831,7 @@ function(CMAKE_DIAGNOSE_UNSUPPORTED_CLANG lang envvar) endif() # Test whether an MSVC-like command-line option works. - execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" /? + execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" -? RESULT_VARIABLE _clang_result OUTPUT_VARIABLE _clang_stdout ERROR_VARIABLE _clang_stderr) diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake index 9edc309..a3c4d9c 100644 --- a/Modules/CMakeDetermineVSServicePack.cmake +++ b/Modules/CMakeDetermineVSServicePack.cmake @@ -79,7 +79,7 @@ endfunction() function(_DetermineVSServicePack_FastCheckVersionWithCompiler _SUCCESS_VAR _VERSION_VAR) if(EXISTS ${CMAKE_CXX_COMPILER}) execute_process( - COMMAND ${CMAKE_CXX_COMPILER} /? + COMMAND ${CMAKE_CXX_COMPILER} -? ERROR_VARIABLE _output OUTPUT_QUIET ) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 5995694..30f8d4c 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -96,13 +96,6 @@ # if defined(__FLANG_PATCHLEVEL__) # define COMPILER_VERSION_PATCH DEC(__FLANG_PATCHLEVEL__) # endif -#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) - PRINT *, 'INFO:compiler[MIPSpro]' -# if 0 -! This compiler is either not known or is too old to define an -! identification macro. Try to identify the platform and guess that -! it is the native compiler. -# endif #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) PRINT *, 'INFO:compiler[VisualAge]' #elif defined(__hpux) || defined(__hpux__) diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake index 21e24b7..6d7732d 100644 --- a/Modules/CMakeParseImplicitIncludeInfo.cmake +++ b/Modules/CMakeParseImplicitIncludeInfo.cmake @@ -92,13 +92,15 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) endif() # XL compiler - if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XL" AND "${line}" MATCHES "^/" + if(("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XL" + OR "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XLClang") + AND "${line}" MATCHES "^/" AND ( ("${lang}" STREQUAL "Fortran" AND "${line}" MATCHES "/xl[fF]entry " AND "${line}" MATCHES "OSVAR\\([^ ]+\\)") OR ( ("${lang}" STREQUAL "C" OR "${lang}" STREQUAL "CXX") AND - "${line}" MATCHES "/xl[cC]entry " AND + "${line}" MATCHES "/xl[cC]2?entry " AND "${line}" MATCHES " -qosvar=") ) ) # -qnostdinc cancels other stdinc flags, even if present diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index 7db976b..5e3f195 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -103,7 +103,8 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}" - COMPILE_OUTPUT_VARIABLE OUTPUT) + COMPILE_OUTPUT_VARIABLE OUTPUT + RUN_OUTPUT_VARIABLE RUN_OUTPUT) # if it did not compile make the return value fail code of 1 if(NOT ${VAR}_COMPILED) @@ -118,6 +119,8 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing C++ SOURCE FILE Test ${VAR} succeeded with the following output:\n" "${OUTPUT}\n" + "...and run output:\n" + "${RUN_OUTPUT}\n" "Return value: ${${VAR}}\n" "Source file was:\n${SOURCE}\n") else() @@ -133,6 +136,8 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" + "...and run output:\n" + "${RUN_OUTPUT}\n" "Return value: ${${VAR}_EXITCODE}\n" "Source file was:\n${SOURCE}\n") endif() diff --git a/Modules/CheckFortranSourceRuns.cmake b/Modules/CheckFortranSourceRuns.cmake index 13fdb0b..a80c13d 100644 --- a/Modules/CheckFortranSourceRuns.cmake +++ b/Modules/CheckFortranSourceRuns.cmake @@ -133,7 +133,8 @@ macro(CHECK_Fortran_SOURCE_RUNS SOURCE VAR) CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} "${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}" - COMPILE_OUTPUT_VARIABLE OUTPUT) + COMPILE_OUTPUT_VARIABLE OUTPUT + RUN_OUTPUT_VARIABLE RUN_OUTPUT) # if it did not compile make the return value fail code of 1 if(NOT ${VAR}_COMPILED) @@ -148,6 +149,8 @@ macro(CHECK_Fortran_SOURCE_RUNS SOURCE VAR) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Performing Fortran SOURCE FILE Test ${VAR} succeeded with the following output:\n" "${OUTPUT}\n" + "...and run output:\n" + "${RUN_OUTPUT}\n" "Return value: ${${VAR}}\n" "Source file was:\n${SOURCE}\n") else() @@ -163,6 +166,8 @@ macro(CHECK_Fortran_SOURCE_RUNS SOURCE VAR) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Performing Fortran SOURCE FILE Test ${VAR} failed with the following output:\n" "${OUTPUT}\n" + "...and run output:\n" + "${RUN_OUTPUT}\n" "Return value: ${${VAR}_EXITCODE}\n" "Source file was:\n${SOURCE}\n") endif() diff --git a/Modules/Compiler/CrayPrgEnv.cmake b/Modules/Compiler/CrayPrgEnv.cmake index 6c1c770..e55e587 100644 --- a/Modules/Compiler/CrayPrgEnv.cmake +++ b/Modules/Compiler/CrayPrgEnv.cmake @@ -1,8 +1,93 @@ # Guard against multiple inclusions -if(__craylinux_crayprgenv) +if(__cmake_craype_crayprgenv) return() endif() -set(__craylinux_crayprgenv 1) +set(__cmake_craype_crayprgenv 1) + +# CrayPrgEnv: loaded when compiling through the Cray compiler wrapper. +# The compiler wrapper can run on a front-end node or a compute node. + +cmake_policy(PUSH) +cmake_policy(SET CMP0057 NEW) # if IN_LIST + +# One-time setup of the craype environment. First, check the wrapper config. +# The wrapper's selection of a compiler (gcc, clang, intel, etc.) and +# default include/library paths is selected using the "module" command. +# The CRAYPE_LINK_TYPE environment variable partly controls if static +# or dynamic binaries are generated (see __cmake_craype_linktype below). +# Running cmake and then changing module and/or linktype configuration +# may cause build problems (since the data in the cmake cache may no +# longer be correct after the change). We can look for this and warn +# the user about it. Second, use the "module" provided PKG_CONFIG_PATH-like +# environment variable to add additional prefixes to the system prefix +# path. +function(__cmake_craype_setupenv) + if(NOT DEFINED __cmake_craype_setupenv_done) # only done once per run + set(__cmake_craype_setupenv_done 1 PARENT_SCOPE) + unset(__cmake_check) + set(CMAKE_CRAYPE_LINKTYPE "$ENV{CRAYPE_LINK_TYPE}" CACHE STRING + "saved value of CRAYPE_LINK_TYPE environment variable") + set(CMAKE_CRAYPE_LOADEDMODULES "$ENV{LOADEDMODULES}" CACHE STRING + "saved value of LOADEDMODULES environment variable") + mark_as_advanced(CMAKE_CRAYPE_LINKTYPE CMAKE_CRAYPE_LOADEDMODULES) + if (NOT "${CMAKE_CRAYPE_LINKTYPE}" STREQUAL "$ENV{CRAYPE_LINK_TYPE}") + string(APPEND __cmake_check "CRAYPE_LINK_TYPE ") + endif() + if (NOT "${CMAKE_CRAYPE_LOADEDMODULES}" STREQUAL "$ENV{LOADEDMODULES}") + string(APPEND __cmake_check "LOADEDMODULES ") + endif() + if(DEFINED __cmake_check) + message(STATUS "NOTE: ${__cmake_check}changed since initial config!") + message(STATUS "NOTE: this may cause unexpected build errors.") + endif() + # loop over variables of interest + foreach(pkgcfgvar PKG_CONFIG_PATH PKG_CONFIG_PATH_DEFAULT + PE_PKG_CONFIG_PATH) + file(TO_CMAKE_PATH "$ENV{${pkgcfgvar}}" pkgcfg) + foreach(path ${pkgcfg}) + string(REGEX REPLACE "(.*)/lib[^/]*/pkgconfig$" "\\1" path "${path}") + if(NOT "${path}" STREQUAL "" AND + NOT "${path}" IN_LIST CMAKE_SYSTEM_PREFIX_PATH) + list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${path}") + endif() + endforeach() + endforeach() + # push it up out of this function into the parent scope + set(CMAKE_SYSTEM_PREFIX_PATH "${CMAKE_SYSTEM_PREFIX_PATH}" PARENT_SCOPE) + endif() +endfunction() + +# The wrapper disables dynamic linking by default. Dynamic linking is +# enabled either by setting $ENV{CRAYPE_LINK_TYPE} to "dynamic" or by +# specifying "-dynamic" to the wrapper when linking. Specifying "-static" +# to the wrapper when linking takes priority over $ENV{CRAYPE_LINK_TYPE}. +# Furthermore, if you specify multiple "-dynamic" and "-static" flags to +# the wrapper when linking, the last one will win. In this case, the +# wrapper will also print a warning like: +# Warning: -dynamic was already seen on command line, overriding with -static. +# +# note that cmake applies both CMAKE_${lang}_FLAGS and CMAKE_EXE_LINKER_FLAGS +# (in that order) to the linking command, so -dynamic can appear in either +# variable. +function(__cmake_craype_linktype lang rv) + # start with ENV, but allow flags to override + if("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") + set(linktype dynamic) + else() + set(linktype static) + endif() + # combine flags and convert to a list so we can apply the flags in order + set(linkflags "${CMAKE_${lang}_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") + string(REPLACE " " ";" linkflags "${linkflags}") + foreach(flag IN LISTS linkflags) + if("${flag}" STREQUAL "-dynamic") + set(linktype dynamic) + elseif("${flag}" STREQUAL "-static") + set(linktype static) + endif() + endforeach() + set(${rv} ${linktype} PARENT_SCOPE) +endfunction() macro(__CrayPrgEnv_setup lang) if(DEFINED ENV{CRAYPE_VERSION}) @@ -13,25 +98,25 @@ macro(__CrayPrgEnv_setup lang) message(STATUS "Cray Programming Environment (unknown version) ${lang}") endif() + # setup the craype environment + __cmake_craype_setupenv() + # Flags for the Cray wrappers set(CMAKE_STATIC_LIBRARY_LINK_${lang}_FLAGS "-static") set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared") set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-dynamic") - # If the link type is not explicitly specified in the environment then - # the Cray wrappers assume that the code will be built statically so - # we check the following condition(s) are NOT met - # Compiler flags are explicitly dynamic - # Env var is dynamic and compiler flags are not explicitly static - if(NOT (((CMAKE_${lang}_FLAGS MATCHES "(^| )-dynamic($| )") OR - (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-dynamic($| )")) - OR - (("$ENV{CRAYPE_LINK_TYPE}" STREQUAL "dynamic") AND - NOT ((CMAKE_${lang}_FLAGS MATCHES "(^| )-static($| )") OR - (CMAKE_EXE_LINKER_FLAGS MATCHES "(^| )-static($| )"))))) + # determine linktype from environment and compiler flags + __cmake_craype_linktype(${lang} __cmake_craype_${lang}_linktype) + + # switch off shared libs if we get a static linktype + if("${__cmake_craype_${lang}_linktype}" STREQUAL "static") set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) set(BUILD_SHARED_LIBS FALSE CACHE BOOL "") set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set(CMAKE_LINK_SEARCH_START_STATIC TRUE) endif() + endmacro() + +cmake_policy(POP) diff --git a/Modules/Compiler/GNU-FindBinUtils.cmake b/Modules/Compiler/GNU-FindBinUtils.cmake index 16b7bbd..097fbf3 100644 --- a/Modules/Compiler/GNU-FindBinUtils.cmake +++ b/Modules/Compiler/GNU-FindBinUtils.cmake @@ -18,7 +18,7 @@ get_filename_component(__gcc_hints "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPIL find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x_y}" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar-${__version_x}" - "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar" + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ar${_CMAKE_COMPILER_SUFFIX}" HINTS ${__gcc_hints} DOC "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler" ) @@ -28,7 +28,7 @@ mark_as_advanced(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR) find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x_y}" "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib-${__version_x}" - "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib" + "${_CMAKE_TOOLCHAIN_PREFIX}gcc-ranlib${_CMAKE_COMPILER_SUFFIX}" HINTS ${__gcc_hints} DOC "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler" ) diff --git a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake index e5b9741..899e284 100644 --- a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake +++ b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake @@ -1,14 +1,6 @@ set(_compiler_id_version_compute " -# if defined(__ibmxl__) -# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__) -# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__) -# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__) -# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__) -# else - /* __IBMC__ = VRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMC__/100) -# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMC__/10 % 10) -# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMC__ % 10) -# endif -") + /* __IBMC__ = VRP */ +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMC__/100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMC__/10 % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMC__ % 10)") diff --git a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake index 63c3e32..73aa2b4 100644 --- a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake +++ b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake @@ -1,14 +1,6 @@ set(_compiler_id_version_compute " -# if defined(__ibmxl__) -# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__) -# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__) -# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__) -# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__) -# else - /* __IBMCPP__ = VRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMCPP__/100) -# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMCPP__/10 % 10) -# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMCPP__ % 10) -# endif -") + /* __IBMCPP__ = VRP */ +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMCPP__/100) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMCPP__/10 % 10) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMCPP__ % 10)") diff --git a/Modules/Compiler/MIPSpro-C.cmake b/Modules/Compiler/MIPSpro-C.cmake deleted file mode 100644 index 675560c..0000000 --- a/Modules/Compiler/MIPSpro-C.cmake +++ /dev/null @@ -1 +0,0 @@ -set(CMAKE_C_VERBOSE_FLAG "-v") diff --git a/Modules/Compiler/MIPSpro-CXX.cmake b/Modules/Compiler/MIPSpro-CXX.cmake deleted file mode 100644 index 9fb191c..0000000 --- a/Modules/Compiler/MIPSpro-CXX.cmake +++ /dev/null @@ -1 +0,0 @@ -set(CMAKE_CXX_VERBOSE_FLAG "-v") diff --git a/Modules/Compiler/MIPSpro-DetermineCompiler.cmake b/Modules/Compiler/MIPSpro-DetermineCompiler.cmake deleted file mode 100644 index 9e48553..0000000 --- a/Modules/Compiler/MIPSpro-DetermineCompiler.cmake +++ /dev/null @@ -1,15 +0,0 @@ - -set(_compiler_id_pp_test "defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)") - -set(_compiler_id_version_compute " -# if defined(_SGI_COMPILER_VERSION) - /* _SGI_COMPILER_VERSION = VRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_SGI_COMPILER_VERSION/100) -# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_SGI_COMPILER_VERSION/10 % 10) -# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_SGI_COMPILER_VERSION % 10) -# else - /* _COMPILER_VERSION = VRP */ -# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_COMPILER_VERSION/100) -# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_COMPILER_VERSION/10 % 10) -# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_COMPILER_VERSION % 10) -# endif") diff --git a/Modules/Compiler/MIPSpro-Fortran.cmake b/Modules/Compiler/MIPSpro-Fortran.cmake deleted file mode 100644 index ffceea8..0000000 --- a/Modules/Compiler/MIPSpro-Fortran.cmake +++ /dev/null @@ -1,3 +0,0 @@ -set(CMAKE_Fortran_VERBOSE_FLAG "-v") -set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixedform") -set(CMAKE_Fortran_FORMAT_FREE_FLAG "-freeform") diff --git a/Modules/Compiler/QCC-ASM.cmake b/Modules/Compiler/QCC-ASM.cmake new file mode 100644 index 0000000..9a9935b --- /dev/null +++ b/Modules/Compiler/QCC-ASM.cmake @@ -0,0 +1,2 @@ +include(Compiler/QCC) +__compiler_qcc(ASM) diff --git a/Modules/Compiler/XL-C-DetermineCompiler.cmake b/Modules/Compiler/XL-C-DetermineCompiler.cmake index 484811e..3f4e05c 100644 --- a/Modules/Compiler/XL-C-DetermineCompiler.cmake +++ b/Modules/Compiler/XL-C-DetermineCompiler.cmake @@ -1,4 +1,4 @@ -set(_compiler_id_pp_test "defined(__ibmxl__) || (defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800)") +set(_compiler_id_pp_test "defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800") include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-C-DetermineVersionInternal.cmake") diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake index 5dc8bc1..6fc9728 100644 --- a/Modules/Compiler/XL-C.cmake +++ b/Modules/Compiler/XL-C.cmake @@ -6,36 +6,15 @@ string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG") # -qthreaded = Ensures that all optimizations will be thread-safe string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded") -# XL v13.1.1 for Linux ppc64 little-endian switched to using a clang based -# front end and accepts the -std= option while only reserving -qlanglevel= for -# compatibility. All other versions (previous versions on Linux ppc64 -# little-endian, all versions on Linux ppc64 big-endian, all versions on AIX -# and BGQ, etc) are derived from the UNIX compiler and only accept the -# -qlanglvl option. if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) - if (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND - CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) - set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") - set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89") - set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") - set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") - if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) - set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") - set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") - else () - set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x") - set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x") - endif () - else () - set(CMAKE_C90_STANDARD_COMPILE_OPTION "-qlanglvl=stdc89") - set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-qlanglvl=extc89") - set(CMAKE_C99_STANDARD_COMPILE_OPTION "-qlanglvl=stdc99") - set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-qlanglvl=extc99") - if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.1) - set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x") - set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x") - endif () + set(CMAKE_C90_STANDARD_COMPILE_OPTION "-qlanglvl=stdc89") + set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-qlanglvl=extc89") + set(CMAKE_C99_STANDARD_COMPILE_OPTION "-qlanglvl=stdc99") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-qlanglvl=extc99") + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.1) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x") endif () endif() -__compiler_check_default_language_standard(C 10.1 90) +__compiler_check_default_language_standard(C 10.1 90 11.1 99) diff --git a/Modules/Compiler/XL-CXX-DetermineCompiler.cmake b/Modules/Compiler/XL-CXX-DetermineCompiler.cmake index 2bf1ec6..dffa4bc 100644 --- a/Modules/Compiler/XL-CXX-DetermineCompiler.cmake +++ b/Modules/Compiler/XL-CXX-DetermineCompiler.cmake @@ -1,4 +1,4 @@ -set(_compiler_id_pp_test "defined(__ibmxl__) || (defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800)") +set(_compiler_id_pp_test "defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800") include("${CMAKE_CURRENT_LIST_DIR}/IBMCPP-CXX-DetermineVersionInternal.cmake") diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index b87e923..0026b4a 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -6,41 +6,16 @@ string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG") # -qthreaded = Ensures that all optimizations will be thread-safe string(APPEND CMAKE_CXX_FLAGS_INIT " -qthreaded") -# XL v13.1.1 for Linux ppc64 little-endian switched to using a clang based -# front end and accepts the -std= option while only reserving -qlanglevel= for -# compatibility. All other versions (previous versions on Linux ppc64 -# little-endian, all versions on Linux ppc64 big-endian, all versions on AIX -# and BGQ, etc) are derived from the UNIX compiler and only accept the -# -qlanglvl option. if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) - if (CMAKE_SYSTEM MATCHES "Linux.*ppc64") - if (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND - CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) - set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98") - set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") - set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") - set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-qlanglvl=extended1y") - else () - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") - endif () - else () - # The non-clang based Linux ppc64 compiler, both big-endian and - # little-endian lacks, the non-extension language level flags - set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-qlanglvl=extended") - set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-qlanglvl=extended") - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") - endif () - else () + if(CMAKE_SYSTEM MATCHES "Linux") + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") + else() set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-qlanglvl=strict98") set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-qlanglvl=extended") - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") - endif () + endif() + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") endif () __compiler_check_default_language_standard(CXX 10.1 98) diff --git a/Modules/Compiler/XL.cmake b/Modules/Compiler/XL.cmake index 68dc28a..a9cec11 100644 --- a/Modules/Compiler/XL.cmake +++ b/Modules/Compiler/XL.cmake @@ -10,12 +10,6 @@ set(__COMPILER_XL 1) include(Compiler/CMakeCommonCompilerMacros) -# Find the CreateExportList program that comes with this toolchain. -find_program(CMAKE_XL_CreateExportList - NAMES CreateExportList - DOC "IBM XL CreateExportList tool" - ) - macro(__compiler_xl lang) # Feature flags. set(CMAKE_${lang}_VERBOSE_FLAG "-V") @@ -35,20 +29,4 @@ macro(__compiler_xl lang) set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") set(CMAKE_DEPFILE_FLAGS_${lang} "-MF <DEPFILE> -qmakedep=gcc") - - # CMAKE_XL_CreateExportList is part of the AIX XL compilers but not the linux ones. - # If we found the tool, we'll use it to create exports, otherwise stick with the regular - # create shared library compile line. - if (CMAKE_XL_CreateExportList) - # The compiler front-end passes all object files, archive files, and shared - # library files named on the command line to CreateExportList to create a - # list of all symbols to be exported from the shared library. This causes - # all archive members to be copied into the shared library whether they are - # needed or not. Instead we run the tool ourselves to pass only the object - # files so that we export only the symbols actually provided by the sources. - set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - "${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>" - "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" - ) - endif() endmacro() diff --git a/Modules/Compiler/XLClang-C-DetermineCompiler.cmake b/Modules/Compiler/XLClang-C-DetermineCompiler.cmake new file mode 100644 index 0000000..4d89921 --- /dev/null +++ b/Modules/Compiler/XLClang-C-DetermineCompiler.cmake @@ -0,0 +1,8 @@ +set(_compiler_id_pp_test "defined(__ibmxl__) && defined(__clang__)") + +set(_compiler_id_version_compute " +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__) +# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__) +") diff --git a/Modules/Compiler/XLClang-C.cmake b/Modules/Compiler/XLClang-C.cmake new file mode 100644 index 0000000..8e8fcf2 --- /dev/null +++ b/Modules/Compiler/XLClang-C.cmake @@ -0,0 +1,17 @@ +include(Compiler/XLClang) +__compiler_xlclang(C) + +if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) + set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") + set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89") + set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x") + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") + endif () +endif() + +__compiler_check_default_language_standard(C 13.1.1 99) diff --git a/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake b/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake new file mode 100644 index 0000000..4d89921 --- /dev/null +++ b/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake @@ -0,0 +1,8 @@ +set(_compiler_id_pp_test "defined(__ibmxl__) && defined(__clang__)") + +set(_compiler_id_version_compute " +# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__ibmxl_version__) +# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__ibmxl_release__) +# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__ibmxl_modification__) +# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__ibmxl_ptf_fix_level__) +") diff --git a/Modules/Compiler/XLClang-CXX.cmake b/Modules/Compiler/XLClang-CXX.cmake new file mode 100644 index 0000000..f535ebc --- /dev/null +++ b/Modules/Compiler/XLClang-CXX.cmake @@ -0,0 +1,20 @@ +include(Compiler/XLClang) +__compiler_xlclang(CXX) + +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") + endif () +endif() + +__compiler_check_default_language_standard(CXX 13.1.1 98) + +set(CMAKE_CXX_COMPILE_OBJECT + "<CMAKE_CXX_COMPILER> -x c++ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") diff --git a/Modules/Compiler/XLClang.cmake b/Modules/Compiler/XLClang.cmake new file mode 100644 index 0000000..cdf0fdc --- /dev/null +++ b/Modules/Compiler/XLClang.cmake @@ -0,0 +1,22 @@ +# 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_XLCLANG) + return() +endif() +set(__COMPILER_XLCLANG 1) + +include(Compiler/XL) + +macro(__compiler_xlclang lang) + __compiler_xl(${lang}) + + # Feature flags. + set(CMAKE_${lang}_VERBOSE_FLAG "-V") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC") + set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIC") + set(CMAKE_${lang}_RESPONSE_FILE_FLAG "@") + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "@") +endmacro() diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index c5d6b45..e097894 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -550,7 +550,8 @@ External Project Definition When enabled, the output of the test step is logged to files. ``LOG_MERGED_STDOUTERR <bool>`` - When enabled, the output the step is not split by stdout and stderr. + When enabled, stdout and stderr will be merged for any step whose + output is being logged to files. ``LOG_OUTPUT_ON_FAILURE <bool>`` This option only has an effect if at least one of the other ``LOG_<step>`` diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 8c112d4..7882c4b 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1807,10 +1807,12 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) foreach(compiler IN LISTS _boost_COMPILER) list(APPEND _boost_RELEASE_NAMES ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} ) endforeach() list(APPEND _boost_RELEASE_NAMES ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} ) @@ -1819,10 +1821,12 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) foreach(compiler IN LISTS _boost_COMPILER) list(APPEND _boost_RELEASE_NAMES ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) endforeach() list(APPEND _boost_RELEASE_NAMES ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) endif() endforeach() @@ -1860,10 +1864,12 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) foreach(compiler IN LISTS _boost_COMPILER) list(APPEND _boost_DEBUG_NAMES ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} ) endforeach() list(APPEND _boost_DEBUG_NAMES ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} ) @@ -1872,10 +1878,12 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) foreach(compiler IN LISTS _boost_COMPILER) list(APPEND _boost_DEBUG_NAMES ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) endforeach() list(APPEND _boost_DEBUG_NAMES ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) endif() endforeach() diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake index 10ce229..27105b9 100644 --- a/Modules/FindCups.cmake +++ b/Modules/FindCups.cmake @@ -5,18 +5,38 @@ FindCups -------- -Try to find the Cups printing system +Find the CUPS printing system. -Once done this will define +Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which +features this function (i.e. at least 1.1.19) -:: +Imported targets +^^^^^^^^^^^^^^^^ - CUPS_FOUND - system has Cups - CUPS_INCLUDE_DIR - the Cups include directory - CUPS_LIBRARIES - Libraries needed to use Cups - CUPS_VERSION_STRING - version of Cups found (since CMake 2.8.8) - Set CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE to TRUE if you need a version which - features this function (i.e. at least 1.1.19) +This module defines :prop_tgt:`IMPORTED` target ``Cups::Cups``, if Cups has +been found. + +Result variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project: + +``CUPS_FOUND`` + true if CUPS headers and libraries were found +``CUPS_INCLUDE_DIRS`` + the directory containing the Cups headers +``CUPS_LIBRARIES`` + the libraries to link against to use CUPS. +``CUPS_VERSION_STRING`` + the version of CUPS found (since CMake 2.8.8) + +Cache variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``CUPS_INCLUDE_DIR`` + the directory containing the Cups headers #]=======================================================================] find_path(CUPS_INCLUDE_DIR cups/cups.h ) @@ -66,3 +86,13 @@ else () endif () mark_as_advanced(CUPS_INCLUDE_DIR CUPS_LIBRARIES) + +if (CUPS_FOUND) + set(CUPS_INCLUDE_DIRS "${CUPS_INCLUDE_DIR}") + if (NOT TARGET Cups::Cups) + add_library(Cups::Cups INTERFACE IMPORTED) + set_target_properties(Cups::Cups PROPERTIES + INTERFACE_LINK_LIBRARIES "${CUPS_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${CUPS_INCLUDE_DIR}") + endif () +endif () diff --git a/Modules/FindOctave.cmake b/Modules/FindOctave.cmake deleted file mode 100644 index 8110ff1..0000000 --- a/Modules/FindOctave.cmake +++ /dev/null @@ -1,179 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindOctave ----------- - -Finds GNU Octave interpreter, libraries and compilers. - -Imported targets -^^^^^^^^^^^^^^^^ - -This module defines the following :prop_tgt:`IMPORTED` targets: - -``Octave::Interpreter`` - Octave interpreter (the main program) -``Octave::Octave`` - include directories and the octave library -``Octave::Octinterp`` - include directories and the octinterp library including the dependency on - Octave::Octave - -If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed. - -Result Variables -^^^^^^^^^^^^^^^^ - -``Octave_FOUND`` - Octave interpreter and/or libraries were found -``Octave_<component>_FOUND`` - Octave <component> specified was found - -``Octave_EXECUTABLE`` - Octave interpreter -``Octave_INCLUDE_DIRS`` - include path for mex.h -``Octave_LIBRARIES`` - octinterp, octave libraries - - -Cache variables -^^^^^^^^^^^^^^^ - -The following cache variables may also be set: - -``Octave_INTERP_LIBRARY`` - path to the library octinterp -``Octave_OCTAVE_LIBRARY`` - path to the liboctave library - -#]=======================================================================] - -cmake_policy(VERSION 3.3) - -unset(Octave_REQUIRED_VARS) -unset(Octave_Development_FOUND) -unset(Octave_Interpreter_FOUND) -set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME Interpreter) - -if(Development IN_LIST Octave_FIND_COMPONENTS) - find_program(Octave_CONFIG_EXECUTABLE - NAMES octave-config) - - if(Octave_CONFIG_EXECUTABLE) - - execute_process(COMMAND ${Octave_CONFIG_EXECUTABLE} -p BINDIR - OUTPUT_VARIABLE Octave_BINARY_DIR - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - - execute_process(COMMAND ${Octave_CONFIG_EXECUTABLE} -p OCTINCLUDEDIR - OUTPUT_VARIABLE Octave_INCLUDE_DIR - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - list(APPEND Octave_REQUIRED_VARS ${Octave_INCLUDE_DIR}) - - execute_process(COMMAND ${Octave_CONFIG_EXECUTABLE} -p OCTLIBDIR - OUTPUT_VARIABLE Octave_LIB1 - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - - execute_process(COMMAND ${Octave_CONFIG_EXECUTABLE} -p LIBDIR - OUTPUT_VARIABLE Octave_LIB2 - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - - find_library(Octave_INTERP_LIBRARY - NAMES octinterp - PATHS ${Octave_LIB1} ${Octave_LIB2} - NO_DEFAULT_PATH - ) - find_library(Octave_OCTAVE_LIBRARY - NAMES octave - PATHS ${Octave_LIB1} ${Octave_LIB2} - NO_DEFAULT_PATH - ) - list(APPEND Octave_REQUIRED_VARS ${Octave_OCTAVE_LIBRARY} ${Octave_INTERP_LIBRARY}) - - if(Octave_REQUIRED_VARS) - set(Octave_Development_FOUND true) - endif() - endif(Octave_CONFIG_EXECUTABLE) -endif() - -if(Interpreter IN_LIST Octave_FIND_COMPONENTS) - - find_program(Octave_EXECUTABLE - NAMES octave) - - list(APPEND Octave_REQUIRED_VARS ${Octave_EXECUTABLE}) - -endif() - -if(Octave_EXECUTABLE) - execute_process(COMMAND ${Octave_EXECUTABLE} -v - OUTPUT_VARIABLE Octave_VERSION - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - - - string(REGEX REPLACE "GNU Octave, version ([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" Octave_VERSION_MAJOR ${Octave_VERSION}) - string(REGEX REPLACE "GNU Octave, version [0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" Octave_VERSION_MINOR ${Octave_VERSION}) - string(REGEX REPLACE "GNU Octave, version [0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" Octave_VERSION_PATCH ${Octave_VERSION}) - - set(Octave_VERSION ${Octave_VERSION_MAJOR}.${Octave_VERSION_MINOR}.${Octave_VERSION_PATCH}) - - set(Octave_Interpreter_FOUND true) - -endif(Octave_EXECUTABLE) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Octave - REQUIRED_VARS Octave_REQUIRED_VARS - VERSION_VAR Octave_VERSION - HANDLE_COMPONENTS) - - -if(Octave_Development_FOUND) - set(Octave_LIBRARIES ${Octave_INTERP_LIBRARY} ${Octave_OCTAVE_LIBRARY}) - set(Octave_INCLUDE_DIRS ${Octave_INCLUDE_DIR}) - - if(NOT TARGET Octave::Octave) - add_library(Octave::Octave UNKNOWN IMPORTED) - set_target_properties(Octave::Octave PROPERTIES - IMPORTED_LOCATION ${Octave_OCTAVE_LIBRARY} - INTERFACE_INCLUDE_DIRECTORIES ${Octave_INCLUDE_DIR} - ) - endif() - - if(NOT TARGET Octave::Octinterp) - add_library(Octave::Octinterp UNKNOWN IMPORTED) - set_target_properties(Octave::Octinterp PROPERTIES - IMPORTED_LOCATION ${Octave_INTERP_LIBRARY} - INTERFACE_INCLUDE_DIRECTORIES ${Octave_INCLUDE_DIR}) - target_link_libraries(Octave::Octinterp INTERFACE - Octave::Octave) - endif() - -endif() - - -if(Octave_Interpreter_FOUND) - if(NOT TARGET Octave::Interpreter) - add_executable(Octave::Interpreter IMPORTED) - set_target_properties(Octave::Interpreter PROPERTIES - IMPORTED_LOCATION ${Octave_EXECUTABLE} - VERSION ${Octave_VERSION}) - endif() -endif() - -mark_as_advanced( - Octave_CONFIG_EXECUTABLE - Octave_INTERP_LIBRARY - Octave_OCTAVE_LIBRARY - Octave_INCLUDE_DIR - Octave_VERSION_MAJOR - Octave_VERSION_MINOR - Octave_VERSION_PATCH -) diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 7e37212..5a34b9e 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -96,7 +96,6 @@ function(_OPENMP_FLAG_CANDIDATES LANG) else() set(OMP_FLAG_Intel "-qopenmp") endif() - set(OMP_FLAG_MIPSpro "-mp") set(OMP_FLAG_MSVC "-openmp") set(OMP_FLAG_PathScale "-openmp") set(OMP_FLAG_NAG "-openmp") diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 5d894c8..919392a 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -118,16 +118,8 @@ if(CMAKE_HAVE_PTHREAD_H) set(CMAKE_HAVE_THREADS_LIBRARY) if(NOT THREADS_HAVE_PTHREAD_ARG) # Check if pthread functions are in normal C library. - # If the pthread functions already exist in C library, we could just use - # them instead of linking to the additional pthread library. We could - # try to check any pthread symbol name, but here is an exception. If we - # use clang asan build, we will find the pthread_create() symbol in the - # libc(libasan). However, it doesn't have the full pthread implementation. - # So, we can't assume that we have the pthread implementation in libc - # using the pthread_create() checking here. Then, we turn to check the - # pthread_kill() symbol instead. - CHECK_SYMBOL_EXISTS(pthread_kill pthread.h CMAKE_HAVE_LIBC_PTHREAD_KILL) - if(CMAKE_HAVE_LIBC_PTHREAD_KILL) + CHECK_SYMBOL_EXISTS(pthread_create pthread.h CMAKE_HAVE_LIBC_CREATE) + if(CMAKE_HAVE_LIBC_CREATE) set(CMAKE_THREAD_LIBS_INIT "") set(CMAKE_HAVE_THREADS_LIBRARY 1) set(Threads_FOUND TRUE) @@ -152,7 +144,7 @@ if(CMAKE_HAVE_PTHREAD_H) _check_pthreads_flag() endif() -if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_PTHREAD_KILL) +if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_CREATE) set(CMAKE_USE_PTHREADS_INIT 1) set(Threads_FOUND TRUE) endif() diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt index e3b81d7..381080b 100644 --- a/Modules/FortranCInterface/CMakeLists.txt +++ b/Modules/FortranCInterface/CMakeLists.txt @@ -15,11 +15,11 @@ int main() { return 0; } # List manglings of global symbol names to try. set(global_symbols my_sub # VisualAge - my_sub_ # GNU, Intel, HP, SunPro, MIPSpro, PGI + my_sub_ # GNU, Intel, HP, SunPro, PGI my_sub__ # GNU g77 MY_SUB # Intel on Windows mysub # VisualAge - mysub_ # GNU, Intel, HP, SunPro, MIPSpro, PGI + mysub_ # GNU, Intel, HP, SunPro, PGI MYSUB # Intel on Windows ${FortranCInterface_GLOBAL_SYMBOLS} ) @@ -48,7 +48,6 @@ set(module_symbols list(REMOVE_DUPLICATES module_symbols) # Note that some compiler manglings cannot be invoked from C: -# MIPSpro uses "MY_SUB.in.MY_MODULE" # SunPro uses "my_module.my_sub_" # PathScale uses "MY_SUB.in.MY_MODULE" diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake index 2de71ee..26b2517 100644 --- a/Modules/Internal/CPack/CPackRPM.cmake +++ b/Modules/Internal/CPack/CPackRPM.cmake @@ -63,6 +63,11 @@ function(get_unix_permissions_octal_notation PERMISSIONS_VAR RETURN_VAR) set(${RETURN_VAR} "${OWNER_PERMISSIONS}${GROUP_PERMISSIONS}${WORLD_PERMISSIONS}" PARENT_SCOPE) endfunction() +function(cpack_rpm_exact_regex regex_var string) + string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" regex "${string}") + set("${regex_var}" "${regex}" PARENT_SCOPE) +endfunction() + function(cpack_rpm_prepare_relocation_paths) # set appropriate prefix, remove possible trailing slash and convert backslashes to slashes if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_PREFIX) @@ -482,7 +487,9 @@ function(cpack_rpm_prepare_install_files INSTALL_FILES_LIST WDIR PACKAGE_PREFIXE # recalculate path length after conversion to canonical form string(LENGTH "${SYMLINK_POINT_}" SYMLINK_POINT_LENGTH_) - if(SYMLINK_POINT_ MATCHES "${WDIR}/.*") + cpack_rpm_exact_regex(IN_SYMLINK_POINT_REGEX "${WDIR}") + string(APPEND IN_SYMLINK_POINT_REGEX "/.*") + if(SYMLINK_POINT_ MATCHES "${IN_SYMLINK_POINT_REGEX}") # only symlinks that are pointing inside the packaging structure should be checked for relocation string(SUBSTRING "${SYMLINK_POINT_}" ${WDR_LEN_} -1 SYMLINK_POINT_WD_) cpack_rpm_symlink_get_relocation_prefixes("${F}" "${PACKAGE_PREFIXES}" "SYMLINK_RELOCATIONS") diff --git a/Modules/Platform/AIX-XL.cmake b/Modules/Platform/AIX-XL.cmake index b3078ff..06a806b 100644 --- a/Modules/Platform/AIX-XL.cmake +++ b/Modules/Platform/AIX-XL.cmake @@ -25,4 +25,26 @@ macro(__aix_compiler_xl lang) set(CMAKE_SHARED_MODULE_${lang}_FLAGS " ") set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath") + + # Find the CreateExportList program that comes with this toolchain. + find_program(CMAKE_XL_CreateExportList + NAMES CreateExportList + DOC "IBM XL CreateExportList tool" + ) + + # CMAKE_XL_CreateExportList is part of the AIX XL compilers but not the linux ones. + # If we found the tool, we'll use it to create exports, otherwise stick with the regular + # create shared library compile line. + if (CMAKE_XL_CreateExportList) + # The compiler front-end passes all object files, archive files, and shared + # library files named on the command line to CreateExportList to create a + # list of all symbols to be exported from the shared library. This causes + # all archive members to be copied into the shared library whether they are + # needed or not. Instead we run the tool ourselves to pass only the object + # files so that we export only the symbols actually provided by the sources. + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "${CMAKE_XL_CreateExportList} <OBJECT_DIR>/objects.exp <OBJECTS>" + "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" + ) + endif() endmacro() diff --git a/Modules/Platform/AIX-XLClang-C.cmake b/Modules/Platform/AIX-XLClang-C.cmake new file mode 100644 index 0000000..f0bedc5 --- /dev/null +++ b/Modules/Platform/AIX-XLClang-C.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-XLClang) +__aix_compiler_xlclang(C) diff --git a/Modules/Platform/AIX-XLClang-CXX.cmake b/Modules/Platform/AIX-XLClang-CXX.cmake new file mode 100644 index 0000000..cceb576 --- /dev/null +++ b/Modules/Platform/AIX-XLClang-CXX.cmake @@ -0,0 +1,2 @@ +include(Platform/AIX-XLClang) +__aix_compiler_xlclang(CXX) diff --git a/Modules/Platform/AIX-XLClang.cmake b/Modules/Platform/AIX-XLClang.cmake new file mode 100644 index 0000000..c932095 --- /dev/null +++ b/Modules/Platform/AIX-XLClang.cmake @@ -0,0 +1,15 @@ +# 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(__AIX_COMPILER_XLCLANG) + return() +endif() +set(__AIX_COMPILER_XLCLANG 1) + +include(Platform/AIX-XL) + +macro(__aix_compiler_xlclang lang) + __aix_compiler_xl(${lang}) +endmacro() diff --git a/Modules/Platform/CrayLinuxEnvironment.cmake b/Modules/Platform/CrayLinuxEnvironment.cmake index a1a3d3f..f2aaf3f 100644 --- a/Modules/Platform/CrayLinuxEnvironment.cmake +++ b/Modules/Platform/CrayLinuxEnvironment.cmake @@ -1,6 +1,5 @@ -# Compute Node Linux doesn't quite work the same as native Linux so all of this -# needs to be custom. We use the variables defined through Cray's environment -# modules to set up the right paths for things. +# CrayLinuxEnvironment: loaded by users cross-compiling on a Cray front-end +# node by specifying "-DCMAKE_SYSTEM_NAME=CrayLinuxEnvironment" to cmake set(UNIX 1) @@ -30,13 +29,6 @@ endif() # Note: this may need to change in the future with 64-bit ARM set(CMAKE_SYSTEM_PROCESSOR "x86_64") -set(CMAKE_SHARED_LIBRARY_PREFIX "lib") -set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") -set(CMAKE_STATIC_LIBRARY_PREFIX "lib") -set(CMAKE_STATIC_LIBRARY_SUFFIX ".a") - -set(CMAKE_FIND_LIBRARY_PREFIXES "lib") - # Don't override shared lib support if it's already been set and possibly # overridden elsewhere by the CrayPrgEnv module if(NOT CMAKE_FIND_LIBRARY_SUFFIXES) @@ -44,12 +36,9 @@ if(NOT CMAKE_FIND_LIBRARY_SUFFIXES) set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) endif() -set(CMAKE_DL_LIBS dl) +# The rest of this file is based on UnixPaths.cmake, adjusted for Cray -# Note: Much of this is pulled from UnixPaths.cmake but adjusted to the Cray -# environment accordingly - -# Get the install directory of the running cmake to the search directories +# add the install directory of the running cmake to the search directories # CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up get_filename_component(__cmake_install_dir "${CMAKE_ROOT}" PATH) get_filename_component(__cmake_install_dir "${__cmake_install_dir}" PATH) @@ -81,7 +70,6 @@ if (NOT CMAKE_FIND_NO_INSTALL_PREFIX) endif() list(APPEND CMAKE_SYSTEM_INCLUDE_PATH - $ENV{SYSROOT_DIR}/usr/include $ENV{SYSROOT_DIR}/usr/include/X11 ) list(APPEND CMAKE_SYSTEM_LIBRARY_PATH @@ -95,57 +83,5 @@ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES $ENV{SYSROOT_DIR}/lib64 ) -# Compute the intersection of several lists -function(__cray_list_intersect OUTPUT INPUT0) - if(ARGC EQUAL 2) - list(APPEND ${OUTPUT} ${${INPUT0}}) - else() - foreach(I IN LISTS ${INPUT0}) - set(__is_common 1) - foreach(L IN LISTS ARGN) - list(FIND ${L} "${I}" __idx) - if(__idx EQUAL -1) - set(__is_common 0) - break() - endif() - endforeach() - if(__is_common) - list(APPEND ${OUTPUT} "${I}") - endif() - endforeach() - endif() - set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) -endfunction() - -macro(__list_clean_dupes var) - if(${var}) - list(REMOVE_DUPLICATES ${var}) - endif() -endmacro() - -get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES) -set(__cray_inc_path_vars) -set(__cray_lib_path_vars) -foreach(__lang IN LISTS __langs) - list(APPEND __cray_inc_path_vars CMAKE_${__lang}_IMPLICIT_INCLUDE_DIRECTORIES) - list(APPEND __cray_lib_path_vars CMAKE_${__lang}_IMPLICIT_LINK_DIRECTORIES) -endforeach() -if(__cray_inc_path_vars) - __cray_list_intersect(__cray_implicit_include_dirs ${__cray_inc_path_vars}) - if(__cray_implicit_include_dirs) - list(INSERT CMAKE_SYSTEM_INCLUDE_PATH 0 ${__cray_implicit_include_dirs}) - endif() -endif() -if(__cray_lib_path_vars) - __cray_list_intersect(__cray_implicit_library_dirs ${__cray_lib_path_vars}) - if(__cray_implicit_library_dirs) - list(INSERT CMAKE_SYSTEM_LIBRARY_PATH 0 ${__cray_implicit_library_dirs}) - endif() -endif() -__list_clean_dupes(CMAKE_SYSTEM_PREFIX_PATH) -__list_clean_dupes(CMAKE_SYSTEM_INCLUDE_PATH) -__list_clean_dupes(CMAKE_SYSTEM_LIBRARY_PATH) -__list_clean_dupes(CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES) - # Enable use of lib64 search path variants by default. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 46c24bb..97f744d 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -63,21 +63,29 @@ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES /lib /lib32 /lib64 /usr/lib /usr/lib32 /usr/lib64 ) +if(CMAKE_SYSROOT_COMPILE) + set(_cmake_sysroot_compile "${CMAKE_SYSROOT_COMPILE}") +else() + set(_cmake_sysroot_compile "${CMAKE_SYSROOT}") +endif() + # Default per-language values. These may be later replaced after # parsing the implicit directory information from compiler output. set(_CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES} - /usr/include + "${_cmake_sysroot_compile}/usr/include" ) set(_CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} - /usr/include + "${_cmake_sysroot_compile}/usr/include" ) set(_CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES} - /usr/include + "${_cmake_sysroot_compile}/usr/include" ) +unset(_cmake_sysroot_compile) + # Enable use of lib32 and lib64 search path variants by default. set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS TRUE) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake index e4b4e53..8c25256 100644 --- a/Modules/ProcessorCount.cmake +++ b/Modules/ProcessorCount.cmake @@ -70,6 +70,20 @@ function(ProcessorCount var) endif() if(NOT count) + # Linux (systems with nproc): + # Prefer nproc to getconf if available as getconf may return the host CPU count in Linux containers + find_program(ProcessorCount_cmd_nproc nproc) + mark_as_advanced(ProcessorCount_cmd_nproc) + if(ProcessorCount_cmd_nproc) + execute_process(COMMAND ${ProcessorCount_cmd_nproc} + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE count) + #message("ProcessorCount: trying nproc '${ProcessorCount_cmd_nproc}'") + endif() + endif() + + if(NOT count) # Linux (systems with getconf): find_program(ProcessorCount_cmd_getconf getconf) mark_as_advanced(ProcessorCount_cmd_getconf) |