diff options
Diffstat (limited to 'Modules')
32 files changed, 613 insertions, 137 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 4b52afa..cfb6450 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -52,6 +52,9 @@ # Then clear all the keys and call verify_app on the final bundle to # ensure that it is truly standalone. # +# As an optional parameter (IGNORE_ITEM) a list of file names can be passed, +# which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") +# # :: # # COPY_AND_FIXUP_BUNDLE(<src> <dst> <libs> <dirs>) @@ -67,6 +70,9 @@ # analysis tools on it. Calls "message(FATAL_ERROR" if the application # is not verified. # +# As an optional parameter (IGNORE_ITEM) a list of file names can be passed, +# which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") +# # :: # # GET_BUNDLE_MAIN_EXECUTABLE(<bundle> <result_var>) @@ -140,6 +146,9 @@ # all of them and copy prerequisite libs into the bundle and then do # appropriate install_name_tool fixups. # +# As an optional parameter (IGNORE_ITEM) a list of file names can be passed, +# which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") +# # :: # # COPY_RESOLVED_ITEM_INTO_BUNDLE(<resolved_item> <resolved_embedded_item>) @@ -196,6 +205,9 @@ # bundle are contained within the bundle or are "system" libraries, # presumed to exist everywhere. # +# As an optional parameter (IGNORE_ITEM) a list of file names can be passed, +# which are then ignored (e.g. IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe") +# # :: # # VERIFY_BUNDLE_SYMLINKS(<bundle> <result_var> <info_var>) @@ -525,6 +537,11 @@ endfunction() function(get_bundle_keys app libs dirs keys_var) set(${keys_var} PARENT_SCOPE) + set(options) + set(oneValueArgs) + set(multiValueArgs IGNORE_ITEM) + cmake_parse_arguments(CFG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + get_bundle_and_executable("${app}" bundle executable valid) if(valid) # Always use the exepath of the main bundle executable for @executable_path @@ -554,10 +571,24 @@ function(get_bundle_keys app libs dirs keys_var) set_bundle_key_values(${keys_var} "${lib}" "${lib}" "${exepath}" "${dirs}" 0 "${main_rpaths}") set(prereqs "") - get_prerequisites("${lib}" prereqs 1 1 "${exepath}" "${dirs}" "${main_rpaths}") - foreach(pr ${prereqs}) - set_bundle_key_values(${keys_var} "${lib}" "${pr}" "${exepath}" "${dirs}" 1 "${main_rpaths}") - endforeach() + set(ignoreFile FALSE) + get_filename_component(prereq_filename ${lib} NAME) + if(NOT "${CFG_IGNORE_ITEM}" STREQUAL "" ) + foreach(item ${CFG_IGNORE_ITEM}) + if("${item}" STREQUAL "${prereq_filename}") + set(ignoreFile TRUE) + endif() + endforeach() + endif() + + if(NOT ignoreFile) + get_prerequisites("${lib}" prereqs 1 1 "${exepath}" "${dirs}" "${main_rpaths}") + foreach(pr ${prereqs}) + set_bundle_key_values(${keys_var} "${lib}" "${pr}" "${exepath}" "${dirs}" 1 "${main_rpaths}") + endforeach() + else() + message(STATUS "Ignoring file: ${prereq_filename}") + endif() endforeach() # For each executable found in the bundle, accumulate keys as we go. @@ -583,10 +614,24 @@ function(get_bundle_keys app libs dirs keys_var) # Add each prerequisite to the keys: # set(prereqs "") - get_prerequisites("${exe}" prereqs 1 1 "${exepath}" "${dirs}" "${exe_rpaths}") - foreach(pr ${prereqs}) - set_bundle_key_values(${keys_var} "${exe}" "${pr}" "${exepath}" "${dirs}" 1 "${exe_rpaths}") - endforeach() + set(ignoreFile FALSE) + get_filename_component(prereq_filename ${exe} NAME) + if(NOT "${CFG_IGNORE_ITEM}" STREQUAL "" ) + foreach(item ${CFG_IGNORE_ITEM}) + if("${item}" STREQUAL "${prereq_filename}") + set(ignoreFile TRUE) + endif() + endforeach() + endif() + + if(NOT ignoreFile) + get_prerequisites("${exe}" prereqs 1 1 "${exepath}" "${dirs}" "${exe_rpaths}") + foreach(pr ${prereqs}) + set_bundle_key_values(${keys_var} "${exe}" "${pr}" "${exepath}" "${dirs}" 1 "${exe_rpaths}") + endforeach() + else() + message(STATUS "Ignoring file: ${prereq_filename}") + endif() endforeach() # Propagate values to caller's scope: @@ -798,12 +843,19 @@ function(fixup_bundle app libs dirs) message(STATUS " libs='${libs}'") message(STATUS " dirs='${dirs}'") + set(options) + set(oneValueArgs) + set(multiValueArgs IGNORE_ITEM) + cmake_parse_arguments(CFG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + + message(STATUS " ignoreItems='${CFG_IGNORE_ITEM}'") + get_bundle_and_executable("${app}" bundle executable valid) if(valid) get_filename_component(exepath "${executable}" PATH) message(STATUS "fixup_bundle: preparing...") - get_bundle_keys("${app}" "${libs}" "${dirs}" keys) + get_bundle_keys("${app}" "${libs}" "${dirs}" keys IGNORE_ITEM "${CFG_IGNORE_ITEM}") message(STATUS "fixup_bundle: copying...") list(LENGTH keys n) @@ -857,7 +909,7 @@ function(fixup_bundle app libs dirs) clear_bundle_keys(keys) message(STATUS "fixup_bundle: verifying...") - verify_app("${app}") + verify_app("${app}" IGNORE_ITEM "${CFG_IGNORE_ITEM}") else() message(SEND_ERROR "error: fixup_bundle: not a valid bundle") endif() @@ -877,6 +929,11 @@ function(verify_bundle_prerequisites bundle result_var info_var) set(info "") set(count 0) + set(options) + set(oneValueArgs) + set(multiValueArgs IGNORE_ITEM) + cmake_parse_arguments(CFG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + get_bundle_main_executable("${bundle}" main_bundle_exe) get_bundle_all_executables("${bundle}" file_list) @@ -887,37 +944,53 @@ function(verify_bundle_prerequisites bundle result_var info_var) message(STATUS "executable file ${count}: ${f}") set(prereqs "") - get_prerequisites("${f}" prereqs 1 1 "${exepath}" "") + set(ignoreFile FALSE) + get_filename_component(prereq_filename ${f} NAME) + + if(NOT "${CFG_IGNORE_ITEM}" STREQUAL "" ) + foreach(item ${CFG_IGNORE_ITEM}) + if("${item}" STREQUAL "${prereq_filename}") + set(ignoreFile TRUE) + endif() + endforeach() + endif() - # On the Mac, - # "embedded" and "system" prerequisites are fine... anything else means - # the bundle's prerequisites are not verified (i.e., the bundle is not - # really "standalone") - # - # On Windows (and others? Linux/Unix/...?) - # "local" and "system" prereqs are fine... - # - set(external_prereqs "") + if(NOT ignoreFile) + get_prerequisites("${f}" prereqs 1 1 "${exepath}" "") - foreach(p ${prereqs}) - set(p_type "") - gp_file_type("${f}" "${p}" p_type) + # On the Mac, + # "embedded" and "system" prerequisites are fine... anything else means + # the bundle's prerequisites are not verified (i.e., the bundle is not + # really "standalone") + # + # On Windows (and others? Linux/Unix/...?) + # "local" and "system" prereqs are fine... + # - if(APPLE) - if(NOT "${p_type}" STREQUAL "embedded" AND NOT "${p_type}" STREQUAL "system") - set(external_prereqs ${external_prereqs} "${p}") - endif() - else() - if(NOT "${p_type}" STREQUAL "local" AND NOT "${p_type}" STREQUAL "system") - set(external_prereqs ${external_prereqs} "${p}") + set(external_prereqs "") + + foreach(p ${prereqs}) + set(p_type "") + gp_file_type("${f}" "${p}" p_type) + + if(APPLE) + if(NOT "${p_type}" STREQUAL "embedded" AND NOT "${p_type}" STREQUAL "system") + set(external_prereqs ${external_prereqs} "${p}") + endif() + else() + if(NOT "${p_type}" STREQUAL "local" AND NOT "${p_type}" STREQUAL "system") + set(external_prereqs ${external_prereqs} "${p}") + endif() endif() - endif() - endforeach() + endforeach() - if(external_prereqs) - # Found non-system/somehow-unacceptable prerequisites: - set(result 0) - set(info ${info} "external prerequisites found:\nf='${f}'\nexternal_prereqs='${external_prereqs}'\n") + if(external_prereqs) + # Found non-system/somehow-unacceptable prerequisites: + set(result 0) + set(info ${info} "external prerequisites found:\nf='${f}'\nexternal_prereqs='${external_prereqs}'\n") + endif() + else() + message(STATUS "Ignoring file: ${prereq_filename}") endif() endforeach() @@ -947,6 +1020,11 @@ function(verify_app app) set(verified 0) set(info "") + set(options) + set(oneValueArgs) + set(multiValueArgs IGNORE_ITEM) + cmake_parse_arguments(CFG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) + get_bundle_and_executable("${app}" bundle executable valid) message(STATUS "===========================================================================") @@ -957,7 +1035,7 @@ function(verify_app app) # Verify that the bundle does not have any "external" prerequisites: # - verify_bundle_prerequisites("${bundle}" verified info) + verify_bundle_prerequisites("${bundle}" verified info IGNORE_ITEM "${CFG_IGNORE_ITEM}") message(STATUS "verified='${verified}'") message(STATUS "info='${info}'") message(STATUS "") diff --git a/Modules/CMakeCCompilerABI.c b/Modules/CMakeCCompilerABI.c index e6a07f4..d36219e 100644 --- a/Modules/CMakeCCompilerABI.c +++ b/Modules/CMakeCCompilerABI.c @@ -6,11 +6,9 @@ # define const #endif -/*--------------------------------------------------------------------------*/ #include "CMakeCompilerABI.h" -/*--------------------------------------------------------------------------*/ #ifdef __CLASSIC_C__ int main(argc, argv) int argc; char *argv[]; diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index c107dfd..95184c9 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -34,7 +34,11 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; @CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@ #if !defined(__STDC__) -# define C_DIALECT +# if defined(_MSC_VER) && !defined(__clang__) +# define C_DIALECT "90" +# else +# define C_DIALECT +# endif #elif __STDC_VERSION__ >= 201000L # define C_DIALECT "11" #elif __STDC_VERSION__ >= 199901L diff --git a/Modules/CMakeCXXCompilerABI.cpp b/Modules/CMakeCXXCompilerABI.cpp index c9b0440..c7ce194 100644 --- a/Modules/CMakeCXXCompilerABI.cpp +++ b/Modules/CMakeCXXCompilerABI.cpp @@ -2,11 +2,9 @@ # error "A C compiler has been selected for C++." #endif -/*--------------------------------------------------------------------------*/ #include "CMakeCompilerABI.h" -/*--------------------------------------------------------------------------*/ int main(int argc, char* argv[]) { diff --git a/Modules/CMakeCompilerABI.h b/Modules/CMakeCompilerABI.h index 26ae4db..95bd791 100644 --- a/Modules/CMakeCompilerABI.h +++ b/Modules/CMakeCompilerABI.h @@ -1,4 +1,3 @@ -/*--------------------------------------------------------------------------*/ /* Size of a pointer-to-data in bytes. */ #define SIZEOF_DPTR (sizeof(void*)) @@ -6,9 +5,10 @@ const char info_sizeof_dptr[] = { 'I', 'N', 'F', 'O', ':', 's', 'i', 'z', 'e', 'o', 'f', '_', 'd', 'p', 't', 'r', '[', ('0' + ((SIZEOF_DPTR / 10)%10)), ('0' + (SIZEOF_DPTR % 10)), - ']','\0'}; + ']','\0' + /* clang-format needs this comment to break after the opening brace */ +}; -/*--------------------------------------------------------------------------*/ /* Application Binary Interface. */ #if defined(__sgi) && defined(_ABIO32) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index b1a2cf2..465989d 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -664,8 +664,8 @@ function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang) ERROR_VARIABLE err RESULT_VARIABLE res ) - if(res EQUAL 0 AND "${out}" MATCHES "\n([^:]*:[^:]*:[ \t]*)") - set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_MATCH_1}" PARENT_SCOPE) + if(res EQUAL 0 AND "${out}" MATCHES "(^|\n)([^:\n]*:[^:\n]*:[ \t]*)") + set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_MATCH_2}" PARENT_SCOPE) else() set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "" PARENT_SCOPE) endif() diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index ccafb07..4f2a70c 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -185,11 +185,10 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) # Fall back to old is-GNU test. if(NOT CMAKE_Fortran_COMPILER_ID) - exec_program(${CMAKE_Fortran_COMPILER} - ARGS ${CMAKE_Fortran_COMPILER_ID_FLAGS_LIST} -E "\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\"" - OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN) + execute_process(COMMAND ${CMAKE_Fortran_COMPILER} ${CMAKE_Fortran_COMPILER_ID_FLAGS_LIST} -E "${CMAKE_ROOT}/Modules/CMakeTestGNU.c" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RESULT_VARIABLE CMAKE_COMPILER_RETURN) if(NOT CMAKE_COMPILER_RETURN) - if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_GNU") + if(CMAKE_COMPILER_OUTPUT MATCHES "THIS_IS_GNU") set(CMAKE_Fortran_COMPILER_ID "GNU") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the Fortran compiler is GNU succeeded with " @@ -200,16 +199,31 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n") endif() if(NOT CMAKE_Fortran_PLATFORM_ID) - if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_MINGW") + if(CMAKE_COMPILER_OUTPUT MATCHES "THIS_IS_MINGW") set(CMAKE_Fortran_PLATFORM_ID "MinGW") endif() - if("${CMAKE_COMPILER_OUTPUT}" MATCHES "THIS_IS_CYGWIN") + if(CMAKE_COMPILER_OUTPUT MATCHES "THIS_IS_CYGWIN") set(CMAKE_Fortran_PLATFORM_ID "Cygwin") endif() endif() endif() endif() + # Fall back for GNU MINGW, which is not always detected correctly + # (__MINGW32__ is defined for the C language, but perhaps not for Fortran!) + if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_Fortran_PLATFORM_ID) + execute_process(COMMAND ${CMAKE_Fortran_COMPILER} ${CMAKE_Fortran_COMPILER_ID_FLAGS_LIST} -E "${CMAKE_ROOT}/Modules/CMakeTestGNU.c" + OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RESULT_VARIABLE CMAKE_COMPILER_RETURN) + if(NOT CMAKE_COMPILER_RETURN) + if(CMAKE_COMPILER_OUTPUT MATCHES "THIS_IS_MINGW") + set(CMAKE_Fortran_PLATFORM_ID "MinGW") + endif() + if(CMAKE_COMPILER_OUTPUT MATCHES "THIS_IS_CYGWIN") + set(CMAKE_Fortran_PLATFORM_ID "Cygwin") + endif() + endif() + endif() + # Set old compiler and platform id variables. if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_COMPILER_IS_GNUG77 1) diff --git a/Modules/CMakeTestWatcomVersion.c b/Modules/CMakeTestWatcomVersion.c deleted file mode 100644 index 0343fb1..0000000 --- a/Modules/CMakeTestWatcomVersion.c +++ /dev/null @@ -1 +0,0 @@ -VERSION=__WATCOMC__ diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake index f31e432..a04d340 100644 --- a/Modules/CTestCoverageCollectGCOV.cmake +++ b/Modules/CTestCoverageCollectGCOV.cmake @@ -2,14 +2,19 @@ # CTestCoverageCollectGCOV # ------------------------ # -# This module provides the function ``ctest_coverage_collect_gcov``. -# The function will run gcov on the .gcda files in a binary tree and then -# package all of the .gcov files into a tar file with a data.json that -# contains the source and build directories for CDash to use in parsing -# the coverage data. In addtion the Labels.json files for targets that -# have coverage information are also put in the tar file for CDash to -# asign the correct labels. This file can be sent to a CDash server for -# display with the +# This module provides the ``ctest_coverage_collect_gcov`` function. +# +# This function runs gcov on all .gcda files found in the binary tree +# and packages the resulting .gcov files into a tar file. +# This tarball also contains the following: +# +# * *data.json* defines the source and build directories for use by CDash. +# * *Labels.json* indicates any :prop_sf:`LABELS` that have been set on the +# source files. +# * The *uncovered* directory holds any uncovered files found by +# :variable:`CTEST_EXTRA_COVERAGE_GLOB`. +# +# After generating this tar file, it can be sent to CDash for display with the # :command:`ctest_submit(CDASH_UPLOAD)` command. # # .. command:: cdash_coverage_collect_gcov @@ -99,11 +104,11 @@ function(ctest_coverage_collect_gcov) set(gcda_files) set(label_files) if (GCOV_GLOB) - file(GLOB_RECURSE gfiles RELATIVE ${binary_dir} "*.gcda") + file(GLOB_RECURSE gfiles RELATIVE ${binary_dir} "${binary_dir}/*.gcda") list(LENGTH gfiles len) # if we have gcda files then also grab the labels file for that target if(${len} GREATER 0) - file(GLOB_RECURSE lfiles RELATIVE ${binary_dir} "Labels.json") + file(GLOB_RECURSE lfiles RELATIVE ${binary_dir} "${binary_dir}/Labels.json") list(APPEND gcda_files ${gfiles}) list(APPEND label_files ${lfiles}) endif() @@ -172,6 +177,21 @@ function(ctest_coverage_collect_gcov) set(unfiltered_gcov_files) file(GLOB_RECURSE unfiltered_gcov_files RELATIVE ${binary_dir} "${coverage_dir}/*.gcov") + # if CTEST_EXTRA_COVERAGE_GLOB was specified we search for files + # that might be uncovered + if (DEFINED CTEST_EXTRA_COVERAGE_GLOB) + set(uncovered_files) + foreach(search_entry IN LISTS CTEST_EXTRA_COVERAGE_GLOB) + if(NOT GCOV_QUIET) + message("Add coverage glob: ${search_entry}") + endif() + file(GLOB_RECURSE matching_files "${source_dir}/${search_entry}") + if (matching_files) + list(APPEND uncovered_files "${matching_files}") + endif() + endforeach() + endif() + set(gcov_files) foreach(gcov_file ${unfiltered_gcov_files}) file(STRINGS ${binary_dir}/${gcov_file} first_line LIMIT_COUNT 1 ENCODING UTF-8) @@ -195,20 +215,62 @@ function(ctest_coverage_collect_gcov) endif() endforeach() + get_filename_component(resolved_source_file "${source_file}" ABSOLUTE) + foreach(uncovered_file IN LISTS uncovered_files) + get_filename_component(resolved_uncovered_file "${uncovered_file}" ABSOLUTE) + if (resolved_uncovered_file STREQUAL resolved_source_file) + list(REMOVE_ITEM uncovered_files "${uncovered_file}") + endif() + endforeach() + if(NOT is_excluded) list(APPEND gcov_files ${gcov_file}) endif() endforeach() + foreach (uncovered_file ${uncovered_files}) + # Check if this uncovered file should be excluded. + set(is_excluded false) + foreach(exclude_entry IN LISTS CTEST_CUSTOM_COVERAGE_EXCLUDE) + if(uncovered_file MATCHES "${exclude_entry}") + set(is_excluded true) + if(NOT GCOV_QUIET) + message("Excluding coverage for: ${uncovered_file} which matches ${exclude_entry}") + endif() + break() + endif() + endforeach() + if(is_excluded) + continue() + endif() + + # Copy from source to binary dir, preserving any intermediate subdirectories. + get_filename_component(filename "${uncovered_file}" NAME) + get_filename_component(relative_path "${uncovered_file}" DIRECTORY) + string(REPLACE "${source_dir}" "" relative_path "${relative_path}") + if (relative_path) + # Strip leading slash. + string(SUBSTRING "${relative_path}" 1 -1 relative_path) + endif() + file(COPY ${uncovered_file} DESTINATION ${binary_dir}/uncovered/${relative_path}) + if(relative_path) + list(APPEND uncovered_files_for_tar uncovered/${relative_path}/${filename}) + else() + list(APPEND uncovered_files_for_tar uncovered/${filename}) + endif() + endforeach() + # tar up the coverage info with the same date so that the md5 # sum will be the same for the tar file independent of file time # stamps string(REPLACE ";" "\n" gcov_files "${gcov_files}") string(REPLACE ";" "\n" label_files "${label_files}") + string(REPLACE ";" "\n" uncovered_files_for_tar "${uncovered_files_for_tar}") file(WRITE "${coverage_dir}/coverage_file_list.txt" "${gcov_files} ${coverage_dir}/data.json ${label_files} +${uncovered_files_for_tar} ") if (GCOV_QUIET) @@ -225,10 +287,14 @@ ${label_files} WORKING_DIRECTORY ${binary_dir}) if (GCOV_DELETE) - string(REPLACE "\n" ";" gcov_files "${gcov_files}") - foreach(gcov_file ${gcov_files}) + foreach(gcov_file ${unfiltered_gcov_files}) file(REMOVE ${binary_dir}/${gcov_file}) endforeach() + file(REMOVE ${coverage_dir}/coverage_file_list.txt) + file(REMOVE ${coverage_dir}/data.json) + if (EXISTS ${binary_dir}/uncovered) + file(REMOVE ${binary_dir}/uncovered) + endif() endif() endfunction() diff --git a/Modules/CheckForPthreads.c b/Modules/CheckForPthreads.c index 344c81b..9629a66 100644 --- a/Modules/CheckForPthreads.c +++ b/Modules/CheckForPthreads.c @@ -1,5 +1,5 @@ -#include <stdio.h> #include <pthread.h> +#include <stdio.h> #include <unistd.h> void* runner(void*); diff --git a/Modules/Compiler/Intel-C-FeatureTests.cmake b/Modules/Compiler/Intel-C-FeatureTests.cmake new file mode 100644 index 0000000..34175c8 --- /dev/null +++ b/Modules/Compiler/Intel-C-FeatureTests.cmake @@ -0,0 +1,23 @@ +# References: +# - https://software.intel.com/en-us/articles/iso-iec-standards-language-conformance-for-intel-c-compiler +# - https://software.intel.com/en-us/articles/c99-support-in-intel-c-compiler +# - https://software.intel.com/en-us/articles/c11-support-in-intel-c-compiler + +# FIXME: Intel C feature detection works only when simulating the GNU compiler. +if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") + return() +endif() + +set(DETECT_C99 "defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L") + +#static assert is only around in version 1500 update 2 and above +set(_cmake_feature_test_c_static_assert "(__INTEL_COMPILER > 1500 || (__INTEL_COMPILER == 1500 && __INTEL_COMPILER_UPDATE > 1) ) && ${DETECT_C99}") + +set(_cmake_oldestSupported "__INTEL_COMPILER >= 1110") +set(Intel_C99 "${_cmake_oldestSupported} && ${DETECT_C99}") +set(_cmake_feature_test_c_restrict "${Intel_C99}") +set(_cmake_feature_test_c_variadic_macros "${Intel_C99}") +set(_cmake_feature_test_c_function_prototypes "${_cmake_oldestSupported}") +unset(Intel_C99) + +unset(DETECT_C99) diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake index 77363eb..eb9602a 100644 --- a/Modules/Compiler/Intel-C.cmake +++ b/Modules/Compiler/Intel-C.cmake @@ -8,5 +8,61 @@ set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") set(CMAKE_DEPFILE_FLAGS_C "-MD -MT <OBJECT> -MF <DEPFILE>") +if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") + set(_std -Qstd) +else() + set(_std -std) +endif() + +if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "${_std}=c11") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "${_std}=c11") +endif() + +if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) + set(CMAKE_C90_STANDARD_COMPILE_OPTION "${_std}=c89") + set(CMAKE_C90_EXTENSION_COMPILE_OPTION "${_std}=c89") + set(CMAKE_C99_STANDARD_COMPILE_OPTION "${_std}=c99") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION "${_std}=c99") +endif() + +if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) + if (NOT CMAKE_C_COMPILER_FORCED) + if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT) + message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}") + endif() + set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}) + elseif(NOT DEFINED CMAKE_C_STANDARD_DEFAULT) + # Compiler id was forced so just guess the default standard level. + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) + set(CMAKE_C_STANDARD_DEFAULT 11) + else() + set(CMAKE_C_STANDARD_DEFAULT 90) + endif() + endif() +endif() + +unset(_std) + +macro(cmake_record_c_compile_features) + macro(_get_intel_c_features std_version list) + record_compiler_features(C "${std_version}" ${list}) + endmacro() + + set(_result 0) + if (NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" AND + NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.1) + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0) + _get_intel_c_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES) + endif() + if (_result EQUAL 0) + _get_intel_c_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES) + endif() + if (_result EQUAL 0) + _get_intel_c_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES) + endif() + endif() +endmacro() + set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") diff --git a/Modules/Compiler/Intel-CXX-FeatureTests.cmake b/Modules/Compiler/Intel-CXX-FeatureTests.cmake new file mode 100644 index 0000000..e111c07 --- /dev/null +++ b/Modules/Compiler/Intel-CXX-FeatureTests.cmake @@ -0,0 +1,96 @@ +# References: +# - https://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler +# - https://software.intel.com/en-us/articles/c14-features-supported-by-intel-c-compiler + +# FIXME: Intel C++ feature detection works only when simulating the GNU compiler. +# When simulating MSVC, Intel always sets __cplusplus to 199711L. +if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + return() +endif() + +# these are not implemented in any version at time of writing +#set(_cmake_feature_test_cxx_variable_templates "${Intel15_CXX14}") +#set(_cmake_feature_test_cxx_relaxed_constexpr "${Intel15_CXX14}") + +set(_cmake_oldestSupported "__INTEL_COMPILER >= 1210") +set(DETECT_CXX11 "((__cplusplus >= 201103L) || defined(__INTEL_CXX11_MODE__) || defined(__GXX_EXPERIMENTAL_CXX0X__))") +#ICC version 15 update 1 has a bug where __cplusplus is defined as 1 no matter +#if you are compiling as 98/11/14. So to properly detect C++14 with this version +#we look for the existence of __GXX_EXPERIMENTAL_CXX0X__ but not __INTEL_CXX11_MODE__ +set(DETECT_BUGGY_ICC15 "((__INTEL_COMPILER == 1500) && (__INTEL_COMPILER_UPDATE == 1))") +set(DETECT_CXX14 "((__cplusplus >= 201300L) || ((__cplusplus == 201103L) && !defined(__INTEL_CXX11_MODE__)) || ((${DETECT_BUGGY_ICC15}) && defined(__GXX_EXPERIMENTAL_CXX0X__) && !defined(__INTEL_CXX11_MODE__) ) )") + +set(Intel16_CXX14 "__INTEL_COMPILER >= 1600 && ${DETECT_CXX14}") +set(_cmake_feature_test_cxx_aggregate_default_initializers "${Intel16_CXX14}") +set(_cmake_feature_test_cxx_contextual_conversions "${Intel16_CXX14}") +set(_cmake_feature_test_cxx_generic_lambdas "${Intel16_CXX14}") +set(_cmake_feature_test_cxx_digit_separators "${Intel16_CXX14}") +# This test is supposed to work in Intel 14 but the compiler has a bug +# in versions 14 and 15:: +# https://software.intel.com/en-us/forums/intel-c-compiler/topic/600514 +# It also appears to fail with an internal compiler error on Intel 16. +#set(_cmake_feature_test_cxx_generalized_initializers "${Intel16_CXX14}") + +set(Intel15_CXX14 "__INTEL_COMPILER >= 1500 && ${DETECT_CXX14}") +set(_cmake_feature_test_cxx_decltype_auto "${Intel15_CXX14}") +set(_cmake_feature_test_cxx_lambda_init_captures "${Intel15_CXX14}") +set(_cmake_feature_test_cxx_attribute_deprecated "${Intel15_CXX14}") +set(_cmake_feature_test_cxx_return_type_deduction "${Intel15_CXX14}") + +set(Intel15_CXX11 "__INTEL_COMPILER >= 1500 && ${DETECT_CXX11}") +set(_cmake_feature_test_cxx_alignas "${Intel15_CXX11}") +set(_cmake_feature_test_cxx_alignof "${Intel15_CXX11}") +set(_cmake_feature_test_cxx_inheriting_constructors "${Intel15_CXX11}") +set(_cmake_feature_test_cxx_user_literals "${Intel15_CXX11}") +set(_cmake_feature_test_cxx_thread_local "${Intel15_CXX11}") + +set(Intel14_CXX11 "${DETECT_CXX11} && (__INTEL_COMPILER > 1400 || (__INTEL_COMPILER == 1400 && __INTEL_COMPILER_UPDATE >= 2))") +# Documented as 12.0+ but in testing it only works on 14.0.2+ +set(_cmake_feature_test_cxx_decltype_incomplete_return_types "${Intel14_CXX11}") + +set(Intel14_CXX11 "__INTEL_COMPILER >= 1400 && ${DETECT_CXX11}") +set(_cmake_feature_test_cxx_delegating_constructors "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_constexpr "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_sizeof_member "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_strong_enums "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_reference_qualified_functions "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_raw_string_literals "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_unicode_literals "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_inline_namespaces "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_unrestricted_unions "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_nonstatic_member_init "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_enum_forward_declarations "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_override "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_final "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_noexcept "${Intel14_CXX11}") +set(_cmake_feature_test_cxx_defaulted_move_initializers "${Intel14_CXX11}") + +set(Intel13_CXX11 "__INTEL_COMPILER >= 1300 && ${DETECT_CXX11}") +set(_cmake_feature_test_cxx_explicit_conversions "${Intel13_CXX11}") +set(_cmake_feature_test_cxx_range_for "${Intel13_CXX11}") +# Cannot find Intel documentation for N2640: cxx_uniform_initialization +set(_cmake_feature_test_cxx_uniform_initialization "${Intel13_CXX11}") + +set(Intel121_CXX11 "${_cmake_oldestSupported} && ${DETECT_CXX11}") +set(_cmake_feature_test_cxx_variadic_templates "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_alias_templates "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_nullptr "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_trailing_return_types "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_attributes "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_default_function_template_args "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_extended_friend_declarations "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_rvalue_references "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_decltype "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_defaulted_functions "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_deleted_functions "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_local_type_template_args "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_lambdas "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_binary_literals "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_static_assert "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_right_angle_brackets "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_auto_type "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_extern_templates "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_variadic_macros "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_long_long_type "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_func_identifier "${Intel121_CXX11}") +set(_cmake_feature_test_cxx_template_template_parameters "${Intel121_CXX11}") diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 02c636c..369e041 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -8,5 +8,69 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG") set(CMAKE_DEPFILE_FLAGS_CXX "-MD -MT <OBJECT> -MF <DEPFILE>") +if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + set(_std -Qstd) +else() + set(_std -std) +endif() + +if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "${_std}=c++14") + # todo: there is no gnu++14 value supported; figure out what to do + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "${_std}=c++14") +elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "${_std}=c++1y") + # todo: there is no gnu++14 value supported; figure out what to do + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "${_std}=c++1y") +endif() + +if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0) + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "${_std}=c++11") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "${_std}=gnu++11") +elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "${_std}=c++0x") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "${_std}=gnu++0x") +endif() + +if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "${_std}=c++98") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "${_std}=gnu++98") +endif() + +if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) + if (NOT CMAKE_CXX_COMPILER_FORCED) + if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) + message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") + else() + set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) + endif() + elseif (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) + # Compiler id was forced so just guess the default standard level. + set(CMAKE_CXX_STANDARD_DEFAULT 98) + endif() +endif() + +unset(_std) + +macro(cmake_record_cxx_compile_features) + macro(_get_intel_features std_version list) + record_compiler_features(CXX "${std_version}" ${list}) + endmacro() + + set(_result 0) + if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" AND + NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0) + _get_intel_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES) + endif() + if (_result EQUAL 0) + _get_intel_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES) + endif() + if (_result EQUAL 0) + _get_intel_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES) + endif() + endif() +endmacro() + set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") diff --git a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake index ad1d14b..79d5962 100644 --- a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake +++ b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake @@ -9,6 +9,10 @@ set(_cmake_oldestSupported "_MSC_VER >= 1600") +# VS 2015 Update 2 introduces support for variable templates. +# https://www.visualstudio.com/en-us/news/vs2015-update2-vs.aspx +set(_cmake_feature_test_cxx_variable_templates "_MSC_FULL_VER >= 190023918") + set(MSVC_2015 "_MSC_VER >= 1900") set(_cmake_feature_test_cxx_alignas "${MSVC_2015}") set(_cmake_feature_test_cxx_alignof "${MSVC_2015}") @@ -95,7 +99,6 @@ set(_cmake_feature_test_cxx_variadic_macros "${MSVC_2010}") # set(_cmake_feature_test_cxx_relaxed_constexpr ) # 'NSDMIs for aggregates' # set(_cmake_feature_test_cxx_aggregate_default_initializers ) -# set(_cmake_feature_test_cxx_variable_templates ) # In theory decltype incomplete return types was added in 2012 # but without support for decltype_auto and return type deduction this diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 2da8354..0ff2eed 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -52,6 +52,7 @@ SVNUpdateOptions: @SVN_UPDATE_OPTIONS@ # Git options GITCommand: @GITCOMMAND@ +GITInitSubmodules: @CTEST_GIT_INIT_SUBMODULES@ GITUpdateOptions: @GIT_UPDATE_OPTIONS@ GITUpdateCustom: @CTEST_GIT_UPDATE_CUSTOM@ diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 1185a81..7dad6e5 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -61,6 +61,10 @@ Create custom targets to build projects in external trees The optional name of the remote, default to ``origin`` ``GIT_SUBMODULES <module>...`` Git submodules that shall be updated, all if empty + ``GIT_SHALLOW 1`` + Tell Git to clone with ``--depth 1``. Use when ``GIT_TAG`` is not + specified or when it names a branch in order to download only the + tip of the branch without the rest of its history. ``HG_REPOSITORY <url>`` URL of mercurial repo ``HG_TAG <tag>`` @@ -499,7 +503,12 @@ define_property(DIRECTORY PROPERTY "EP_UPDATE_DISCONNECTED" INHERITED "ExternalProject module." ) -function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_remote_name git_submodules src_name work_dir gitclone_infofile gitclone_stampfile) +function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag git_remote_name git_submodules git_shallow src_name work_dir gitclone_infofile gitclone_stampfile tls_verify) + if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.10) + set(git_clone_shallow_options "--depth 1 --no-single-branch") + else() + set(git_clone_shallow_options "--depth 1") + endif() file(WRITE ${script_filename} "if(\"${git_tag}\" STREQUAL \"\") message(FATAL_ERROR \"Tag for git checkout should not be empty.\") @@ -524,12 +533,28 @@ if(error_code) message(FATAL_ERROR \"Failed to remove directory: '${source_dir}'\") endif() +set(git_options) + +# disable cert checking if explicitly told not to do it +set(tls_verify \"${tls_verify}\") +if(NOT \"x${tls_verify}\" STREQUAL \"x\" AND NOT tls_verify) + list(APPEND git_options + -c http.sslVerify=false) +endif() + +set(git_clone_options) + +set(git_shallow \"${git_shallow}\") +if(git_shallow) + list(APPEND git_clone_options ${git_clone_shallow_options}) +endif() + # try the clone 3 times incase there is an odd git clone issue set(error_code 1) set(number_of_tries 0) while(error_code AND number_of_tries LESS 3) execute_process( - COMMAND \"${git_EXECUTABLE}\" clone --origin \"${git_remote_name}\" \"${git_repository}\" \"${src_name}\" + COMMAND \"${git_EXECUTABLE}\" \${git_options} clone \${git_clone_options} --origin \"${git_remote_name}\" \"${git_repository}\" \"${src_name}\" WORKING_DIRECTORY \"${work_dir}\" RESULT_VARIABLE error_code ) @@ -544,7 +569,7 @@ if(error_code) endif() execute_process( - COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag} + COMMAND \"${git_EXECUTABLE}\" \${git_options} checkout ${git_tag} WORKING_DIRECTORY \"${work_dir}/${src_name}\" RESULT_VARIABLE error_code ) @@ -553,7 +578,7 @@ if(error_code) endif() execute_process( - COMMAND \"${git_EXECUTABLE}\" submodule init ${git_submodules} + COMMAND \"${git_EXECUTABLE}\" \${git_options} submodule init ${git_submodules} WORKING_DIRECTORY \"${work_dir}/${src_name}\" RESULT_VARIABLE error_code ) @@ -562,7 +587,7 @@ if(error_code) endif() execute_process( - COMMAND \"${git_EXECUTABLE}\" submodule update --recursive ${git_submodules} + COMMAND \"${git_EXECUTABLE}\" \${git_options} submodule update --recursive --init ${git_submodules} WORKING_DIRECTORY \"${work_dir}/${src_name}\" RESULT_VARIABLE error_code ) @@ -808,7 +833,7 @@ if(error_code OR is_remote_ref OR NOT (\"\${tag_sha}\" STREQUAL \"\${head_sha}\" endif() execute_process( - COMMAND \"${git_EXECUTABLE}\" submodule update --recursive ${git_submodules} + COMMAND \"${git_EXECUTABLE}\" submodule update --recursive --init ${git_submodules} WORKING_DIRECTORY \"${work_dir}/${src_name}\" RESULT_VARIABLE error_code ) @@ -850,12 +875,15 @@ function(_ep_write_downloadfile_script script_filename remote local timeout no_p set(hash_check "") endif() + set(tls_verify_code "") + set(tls_cainfo_code "") + # check for curl globals in the project if(DEFINED CMAKE_TLS_VERIFY) - set(tls_verify "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})") + set(tls_verify_code "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})") endif() if(DEFINED CMAKE_TLS_CAINFO) - set(tls_cainfo "set(CMAKE_TLS_CAINFO \"${CMAKE_TLS_CAINFO}\")") + set(tls_cainfo_code "set(CMAKE_TLS_CAINFO \"${CMAKE_TLS_CAINFO}\")") endif() # now check for curl locals so that the local values @@ -864,12 +892,12 @@ function(_ep_write_downloadfile_script script_filename remote local timeout no_p # check for tls_verify argument string(LENGTH "${tls_verify}" tls_verify_len) if(tls_verify_len GREATER 0) - set(tls_verify "set(CMAKE_TLS_VERIFY ${tls_verify})") + set(tls_verify_code "set(CMAKE_TLS_VERIFY ${tls_verify})") endif() # check for tls_cainfo argument string(LENGTH "${tls_cainfo}" tls_cainfo_len) if(tls_cainfo_len GREATER 0) - set(tls_cainfo "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")") + set(tls_cainfo_code "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")") endif() file(WRITE ${script_filename} @@ -878,8 +906,8 @@ function(_ep_write_downloadfile_script script_filename remote local timeout no_p dst='${local}' timeout='${timeout_msg}'\") -${tls_verify} -${tls_cainfo} +${tls_verify_code} +${tls_cainfo_code} file(DOWNLOAD \"${remote}\" @@ -1777,6 +1805,12 @@ function(_ep_add_download_command name) set(git_remote_name "origin") endif() + get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY) + if("x${tls_verify}" STREQUAL "x" AND DEFINED CMAKE_TLS_VERIFY) + set(tls_verify "${CMAKE_TLS_VERIFY}") + endif() + get_property(git_shallow TARGET ${name} PROPERTY _EP_GIT_SHALLOW) + # For the download step, and the git clone operation, only the repository # should be recorded in a configured RepositoryInfo file. If the repo # changes, the clone script should be run again. But if only the tag @@ -1800,8 +1834,8 @@ function(_ep_add_download_command name) # The script will delete the source directory and then call git clone. # _ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir} - ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${git_remote_name} "${git_submodules}" ${src_name} ${work_dir} - ${stamp_dir}/${name}-gitinfo.txt ${stamp_dir}/${name}-gitclone-lastrun.txt + ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${git_remote_name} "${git_submodules}" "${git_shallow}" ${src_name} ${work_dir} + ${stamp_dir}/${name}-gitinfo.txt ${stamp_dir}/${name}-gitclone-lastrun.txt "${tls_verify}" ) set(comment "Performing download step (git clone) for '${name}'") set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitclone.cmake) diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index 7d81276..69293f5 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -125,10 +125,10 @@ if(BISON_EXECUTABLE) get_filename_component(BISON_TARGET_output_path "${BisonOutput}" PATH) get_filename_component(BISON_TARGET_output_name "${BisonOutput}" NAME_WE) add_custom_command(OUTPUT ${filename} - COMMAND ${CMAKE_COMMAND} - ARGS -E copy + COMMAND ${CMAKE_COMMAND} -E copy "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output" "${filename}" + VERBATIM DEPENDS "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output" COMMENT "[BISON][${Name}] Copying bison verbose table to ${filename}" @@ -201,8 +201,8 @@ if(BISON_EXECUTABLE) add_custom_command(OUTPUT ${BISON_TARGET_outputs} ${BISON_TARGET_extraoutputs} - COMMAND ${BISON_EXECUTABLE} - ARGS ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput} + COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput} + VERBATIM DEPENDS ${BisonInput} COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 546ada1..728494c 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -59,12 +59,7 @@ set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY}) set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) # Check the language being used -get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES ) -if( _LANGUAGES_ MATCHES Fortran ) - set( _CHECK_FORTRAN TRUE ) -elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) ) - set( _CHECK_FORTRAN FALSE ) -else() +if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) ) if(BLAS_FIND_REQUIRED) message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.") else() @@ -132,7 +127,7 @@ if(_libraries_work) # Test this combination of libraries. set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread}) # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") - if (_CHECK_FORTRAN) + if (CMAKE_Fortran_COMPILER_LOADED) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) else() check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) @@ -483,7 +478,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") if (NOT WIN32) set(LM "-lm") endif () - if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) + if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED) if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) find_package(Threads) else() diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 9e6083db..3d573b8 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -982,7 +982,7 @@ if(NOT Boost_INCLUDE_DIR) endif() if( Boost_NO_SYSTEM_PATHS) - list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH) + list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH) else() list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS C:/boost/include @@ -1251,7 +1251,7 @@ foreach(c DEBUG RELEASE) ${Boost_INCLUDE_DIR}/stage/lib ) if( Boost_NO_SYSTEM_PATHS ) - list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH) + list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH) else() list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS C:/boost/lib @@ -1573,7 +1573,7 @@ endif() # Add imported targets # ------------------------------------------------------------------------ -if(Boost_FOUND AND _Boost_IMPORTED_TARGETS) +if(Boost_FOUND) # For header-only libraries if(NOT TARGET Boost::boost) add_library(Boost::boost INTERFACE IMPORTED) @@ -1584,7 +1584,7 @@ if(Boost_FOUND AND _Boost_IMPORTED_TARGETS) endif() foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - if(NOT TARGET Boost::${COMPONENT}) + if(_Boost_IMPORTED_TARGETS AND NOT TARGET Boost::${COMPONENT}) string(TOUPPER ${COMPONENT} UPPERCOMPONENT) if(Boost_${UPPERCOMPONENT}_FOUND) if(Boost_USE_STATIC_LIBS) diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index ca66493..b50c74a 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -185,8 +185,8 @@ if(FLEX_EXECUTABLE) endif() add_custom_command(OUTPUT ${FLEX_TARGET_outputs} - COMMAND ${FLEX_EXECUTABLE} - ARGS ${FLEX_EXECUTABLE_opts} -o${Output} ${Input} + COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXECUTABLE_opts} -o${Output} ${Input} + VERBATIM DEPENDS ${Input} COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/Modules/FindGSL.cmake b/Modules/FindGSL.cmake index ef125c0..9318a7d 100644 --- a/Modules/FindGSL.cmake +++ b/Modules/FindGSL.cmake @@ -45,7 +45,7 @@ # of GSL installation discovered. These variables may optionally be set to # help this module find the correct files:: # -# GSL_CLBAS_LIBRARY - Location of the GSL CBLAS library. +# GSL_CBLAS_LIBRARY - Location of the GSL CBLAS library. # GSL_CBLAS_LIBRARY_DEBUG - Location of the debug GSL CBLAS library (if any). # GSL_CONFIG_EXECUTABLE - Location of the ``gsl-config`` script (if any). # GSL_LIBRARY - Location of the GSL library. diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake index d18f965..95188ce 100644 --- a/Modules/FindGit.cmake +++ b/Modules/FindGit.cmake @@ -45,8 +45,10 @@ if(WIN32) if(NOT CMAKE_GENERATOR MATCHES "MSYS") set(git_names git.cmd git eg.cmd eg) # GitHub search path for Windows - set(github_path "$ENV{LOCALAPPDATA}/Github/PortableGit*/bin") - file(GLOB github_path "${github_path}") + file(GLOB github_path + "$ENV{LOCALAPPDATA}/Github/PortableGit*/cmd" + "$ENV{LOCALAPPDATA}/Github/PortableGit*/bin" + ) # SourceTree search path for Windows set(_git_sourcetree_path "$ENV{LOCALAPPDATA}/Atlassian/SourceTree/git_local/bin") endif() diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index a129671..17a2aeb 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -484,10 +484,10 @@ if( NOT HDF5_FOUND ) # See https://cmake.org/Bug/view.php?id=1643. We search # first for the full static library name, but fall back to a # generic search on the name if the static search fails. - set( THIS_LIBRARY_SEARCH_DEBUG lib${LIB}d.a ${LIB}d ) + set( THIS_LIBRARY_SEARCH_DEBUG lib${LIB}d.a lib${LIB}_debug.a ${LIB}d ${LIB}_debug ) set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a ${LIB} ) else() - set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ) + set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ${LIB}_debug ) set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ) endif() find_library( HDF5_${LIB}_LIBRARY_DEBUG diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 2708de0..a6bf89f 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -48,11 +48,20 @@ set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) -get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) -if (NOT _LANGUAGES_ MATCHES Fortran) -include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) -else () +# Check the language being used +if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED) ) + if(LAPACK_FIND_REQUIRED) + message(FATAL_ERROR "FindLAPACK requires Fortran, C, or C++ to be enabled.") + else() + message(STATUS "Looking for LAPACK... - NOT found (Unsupported languages)") + return() + endif() +endif() + +if (CMAKE_Fortran_COMPILER_LOADED) include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake) +else () +include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) endif () include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) @@ -125,7 +134,7 @@ if(_libraries_work) set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads}) endif() # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") - if (NOT _LANGUAGES_ MATCHES Fortran) + if (NOT CMAKE_Fortran_COMPILER_LOADED) check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) else () check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) @@ -250,7 +259,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") if (NOT WIN32) set(LM "-lm") endif () - if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) + if (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED) if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) find_PACKAGE(Threads) else() diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 48adf3c..fbc6795 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -11,7 +11,8 @@ # of them have somewhat different include paths, libraries to link # against, etc., and this module tries to smooth out those differences. # -# === Variables === +# Variables +# ^^^^^^^^^ # # This module will set the following variables per language in your # project, where <lang> is one of C, CXX, or Fortran: @@ -37,11 +38,12 @@ # before the executable to run. # MPIEXEC_POSTFLAGS Flags to pass to MPIEXEC after other flags # -# === Usage === +# Usage +# ^^^^^ # # To use this module, simply call FindMPI from a CMakeLists.txt file, or -# run find_package(MPI), then run CMake. If you are happy with the -# auto- detected configuration for your language, then you're done. If +# run ``find_package(MPI)``, then run CMake. If you are happy with the +# auto-detected configuration for your language, then you're done. If # not, you have two options: # # :: @@ -55,24 +57,25 @@ # listed above, but these two are required. This will circumvent # autodetection entirely. # -# When configuration is successful, MPI_<lang>_COMPILER will be set to -# the compiler wrapper for <lang>, if it was found. MPI_<lang>_FOUND +# When configuration is successful, ``MPI_<lang>_COMPILER`` will be set to +# the compiler wrapper for <lang>, if it was found. ``MPI_<lang>_FOUND`` # and other variables above will be set if any MPI implementation was # found for <lang>, regardless of whether a compiler was found. # -# When using MPIEXEC to execute MPI applications, you should typically -# use all of the MPIEXEC flags as follows: +# When using ``MPIEXEC`` to execute MPI applications, you should typically +# use all of the ``MPIEXEC`` flags as follows: # # :: # # ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS # ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS # -# where PROCS is the number of processors on which to execute the -# program, EXECUTABLE is the MPI program, and ARGS are the arguments to +# where ``PROCS`` is the number of processors on which to execute the +# program, ``EXECUTABLE`` is the MPI program, and ``ARGS`` are the arguments to # pass to the MPI program. # -# === Backward Compatibility === +# Backward Compatibility +# ^^^^^^^^^^^^^^^^^^^^^^ # # For backward compatibility with older versions of FindMPI, these # variables are set, but deprecated: @@ -83,7 +86,7 @@ # MPI_COMPILE_FLAGS MPI_INCLUDE_PATH MPI_EXTRA_LIBRARY # MPI_LINK_FLAGS MPI_LIBRARIES # -# In new projects, please use the MPI_<lang>_XXX equivalents. +# In new projects, please use the ``MPI_<lang>_XXX`` equivalents. #============================================================================= # Copyright 2001-2011 Kitware, Inc. @@ -354,10 +357,10 @@ function (interrogate_mpi_compiler lang try_libs) endif() # Extract linker paths from the link command line - string(REGEX MATCHALL "(^| |-Wl,)-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}") + string(REGEX MATCHALL "(^| |-Wl,)(-L|/LIBPATH:)([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}") set(MPI_LINK_PATH) foreach(LPATH ${MPI_ALL_LINK_PATHS}) - string(REGEX REPLACE "^(| |-Wl,)-L" "" LPATH ${LPATH}) + string(REGEX REPLACE "^(| |-Wl,)(-L|/LIBPATH:)" "" LPATH ${LPATH}) string(REPLACE "//" "/" LPATH ${LPATH}) list(APPEND MPI_LINK_PATH ${LPATH}) endforeach() @@ -382,6 +385,13 @@ function (interrogate_mpi_compiler lang try_libs) # Extract the set of libraries to link against from the link command # line string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}") + if(WIN32) + # The intel wrappers on windows link against static versions of the MPI libraries. + # The static libraries are simply listed on the command line without -l. + # For instance: " icl ... impi.lib " + string(REGEX MATCHALL "(^| )([^\" ]+)\\.lib" tmp "${MPI_LINK_CMDLINE}") + list(APPEND MPI_LIBNAMES ${tmp}) + endif() # add the compiler implicit directories because some compilers # such as the intel compiler have libraries that show up @@ -396,6 +406,10 @@ function (interrogate_mpi_compiler lang try_libs) # to link against in an MPI program foreach(LIB ${MPI_LIBNAMES}) string(REGEX REPLACE "^ ?-l" "" LIB ${LIB}) + if(WIN32) + string(REGEX REPLACE "\\.lib$" "" LIB ${LIB}) + endif() + string(STRIP ${LIB} LIB) # MPI_LIB is cached by find_library, but we don't want that. Clear it first. set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE) find_library(MPI_LIB NAMES ${LIB} HINTS ${MPI_LINK_PATH}) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 8b4b988..8dbaf11 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -151,6 +151,7 @@ if(WIN32 AND NOT CYGWIN) NAMES libeay32${_OPENSSL_MSVC_RT_MODE}d libeay32d + NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES ${_OPENSSL_PATH_SUFFIXES} @@ -160,6 +161,7 @@ if(WIN32 AND NOT CYGWIN) NAMES libeay32${_OPENSSL_MSVC_RT_MODE} libeay32 + NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES ${_OPENSSL_PATH_SUFFIXES} @@ -169,6 +171,7 @@ if(WIN32 AND NOT CYGWIN) NAMES ssleay32${_OPENSSL_MSVC_RT_MODE}d ssleay32d + NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES ${_OPENSSL_PATH_SUFFIXES} @@ -179,6 +182,7 @@ if(WIN32 AND NOT CYGWIN) ssleay32${_OPENSSL_MSVC_RT_MODE} ssleay32 ssl + NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES ${_OPENSSL_PATH_SUFFIXES} @@ -205,6 +209,7 @@ if(WIN32 AND NOT CYGWIN) find_library(LIB_EAY NAMES ${LIB_EAY_NAMES} + NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib" @@ -214,6 +219,7 @@ if(WIN32 AND NOT CYGWIN) find_library(SSL_EAY NAMES ${SSL_EAY_NAMES} + NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib" @@ -231,6 +237,7 @@ if(WIN32 AND NOT CYGWIN) find_library(LIB_EAY NAMES libeay32 + NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} HINTS ${_OPENSSL_LIBDIR} @@ -241,6 +248,7 @@ if(WIN32 AND NOT CYGWIN) find_library(SSL_EAY NAMES ssleay32 + NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} HINTS ${_OPENSSL_LIBDIR} @@ -260,6 +268,7 @@ else() ssl ssleay32 ssleay32MD + NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} HINTS ${_OPENSSL_LIBDIR} @@ -270,6 +279,7 @@ else() find_library(OPENSSL_CRYPTO_LIBRARY NAMES crypto + NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS} HINTS ${_OPENSSL_LIBDIR} diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 9ea1281..dd294f4 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -663,10 +663,21 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa endif() set(gp_cmd_paths ${gp_cmd_paths} + "$ENV{VS140COMNTOOLS}/../../VC/bin" + "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin" + "$ENV{VS120COMNTOOLS}/../../VC/bin" + "C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin" + "$ENV{VS110COMNTOOLS}/../../VC/bin" + "C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin" + "$ENV{VS100COMNTOOLS}/../../VC/bin" + "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin" + "$ENV{VS90COMNTOOLS}/../../VC/bin" "C:/Program Files/Microsoft Visual Studio 9.0/VC/bin" "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin" + "$ENV{VS80COMNTOOLS}/../../VC/bin" "C:/Program Files/Microsoft Visual Studio 8/VC/BIN" "C:/Program Files (x86)/Microsoft Visual Studio 8/VC/BIN" + "$ENV{VS71COMNTOOLS}/../../VC7/bin" "C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN" "C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN" "/usr/local/bin" diff --git a/Modules/Platform/Windows-Intel-Fortran.cmake b/Modules/Platform/Windows-Intel-Fortran.cmake index 0f9a10a..1b93db8 100644 --- a/Modules/Platform/Windows-Intel-Fortran.cmake +++ b/Modules/Platform/Windows-Intel-Fortran.cmake @@ -6,6 +6,6 @@ set(CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") __windows_compiler_intel(Fortran) set (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads") set (CMAKE_Fortran_FLAGS_DEBUG_INIT "/Od /debug:full /dbglibs") -set (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O1 /D NDEBUG") -set (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O2 /D NDEBUG") -set (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O2 /debug:full /D NDEBUG") +set (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O1 /DNDEBUG") +set (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O2 /DNDEBUG") +set (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O2 /debug:full /DNDEBUG") diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index deaa88e..1920a7c 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -303,15 +303,15 @@ macro(__windows_compiler_msvc lang) # that include MS's own headers. CMake itself is affected project too. set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} -fms-extensions -fms-compatibility -D_WINDOWS -Wall${_FLAGS_${lang}}") set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-D_DEBUG /MDd -gline-tables-only -fno-inline -O0 ${_RTC1}") - set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD -O2 -D NDEBUG") - set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD -gline-tables-only -O2 -fno-inline -D NDEBUG") - set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD -Os -D NDEBUG") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD -O2 -DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD -gline-tables-only -O2 -fno-inline -DNDEBUG") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD -Os -DNDEBUG") else() set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}") set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}") - set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /DNDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /DNDEBUG") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /DNDEBUG") endif() set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) set(CMAKE_NINJA_DEPTYPE_${lang} msvc) diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 3850890..b59fe34 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -389,7 +389,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) function (__java_copy_file src dest comment) add_custom_command( OUTPUT ${dest} - COMMAND cmake -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different ARGS ${src} ${dest} DEPENDS ${src} diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index a3b73bb..2669a84 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -36,7 +36,7 @@ # PREFIX ClimbingStats # OUTPUT_FILES_VAR support_files # OUTPUT_DIR compilers -# COMPILERS GNU Clang MSVC +# COMPILERS GNU Clang MSVC Intel # FEATURES cxx_variadic_templates # ) # install(FILES @@ -100,7 +100,7 @@ # write_compiler_detection_header( # FILE climbingstats_compiler_detection.h # PREFIX ClimbingStats -# COMPILERS GNU Clang AppleClang MSVC +# COMPILERS GNU Clang AppleClang MSVC Intel # FEATURES cxx_variadic_templates # ) # @@ -323,6 +323,7 @@ function(write_compiler_detection_header AppleClang MSVC SunPro + Intel ) set(_hex_compilers ADSP Borland Embarcadero SunPro) |