Modules: Use new keyword-dispatched try_compile signature
Modify most of the modules that ship with CMake to use the new
try_compile / try_run signatures added by commit aa9220d3a0
(try_compile: Add keyword-dispatched signature, 2022-09-02). This
improves debugging by each invocation using its own directory so that
the results of multiple invocations can be retained.
This does not cover any invocations which provide an entire project, as
that flavor of try_compile has not yet been updated.
stage/master/nightly/2022/09/15
parent
83686df1d6
commit
2edf0fc6d7
|
@ -55,7 +55,7 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
|
|||
set(ENV{LANG} C)
|
||||
|
||||
try_compile(CMAKE_${lang}_ABI_COMPILED
|
||||
${CMAKE_BINARY_DIR} ${src}
|
||||
SOURCES ${src}
|
||||
CMAKE_FLAGS ${CMAKE_FLAGS}
|
||||
# Ignore unused flags when we are just determining the ABI.
|
||||
"--no-warn-unused-cli"
|
||||
|
|
|
@ -105,8 +105,7 @@ function(_DetermineVSServicePack_CheckVersionWithTryCompile _SUCCESS_VAR _VERSI
|
|||
|
||||
try_compile(
|
||||
_CompileResult
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/return0.cc"
|
||||
SOURCES "${CMAKE_BINARY_DIR}/return0.cc"
|
||||
OUTPUT_VARIABLE _output
|
||||
COPY_FILE "${CMAKE_BINARY_DIR}/return0.cc")
|
||||
|
||||
|
@ -128,8 +127,7 @@ function(_DetermineVSServicePack_CheckVersionWithTryRun _SUCCESS_VAR _VERSION_V
|
|||
try_run(
|
||||
_RunResult
|
||||
_CompileResult
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/return0.cc"
|
||||
SOURCES "${CMAKE_BINARY_DIR}/return0.cc"
|
||||
RUN_OUTPUT_VARIABLE _runoutput
|
||||
)
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ if(NOT CMAKE_C_COMPILER_WORKS)
|
|||
# Clear result from normal variable.
|
||||
unset(CMAKE_C_COMPILER_WORKS)
|
||||
# Puts test result in cache variable.
|
||||
try_compile(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c
|
||||
try_compile(CMAKE_C_COMPILER_WORKS
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c
|
||||
OUTPUT_VARIABLE __CMAKE_C_COMPILER_OUTPUT)
|
||||
# Move result from cache to normal variable.
|
||||
set(CMAKE_C_COMPILER_WORKS ${CMAKE_C_COMPILER_WORKS})
|
||||
|
|
|
@ -33,7 +33,8 @@ if(NOT CMAKE_CSharp_COMPILER_WORKS)
|
|||
# Clear result from normal variable.
|
||||
unset(CMAKE_CSharp_COMPILER_WORKS)
|
||||
# Puts test result in cache variable.
|
||||
try_compile(CMAKE_CSharp_COMPILER_WORKS ${CMAKE_BINARY_DIR} "${test_compile_file}"
|
||||
try_compile(CMAKE_CSharp_COMPILER_WORKS
|
||||
SOURCES "${test_compile_file}"
|
||||
OUTPUT_VARIABLE __CMAKE_CSharp_COMPILER_OUTPUT
|
||||
)
|
||||
# Move result from cache to normal variable.
|
||||
|
|
|
@ -86,8 +86,8 @@ if(NOT CMAKE_CUDA_COMPILER_WORKS)
|
|||
unset(CMAKE_CUDA_COMPILER_WORKS)
|
||||
|
||||
# Puts test result in cache variable.
|
||||
try_compile(CMAKE_CUDA_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.cu
|
||||
try_compile(CMAKE_CUDA_COMPILER_WORKS
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.cu
|
||||
OUTPUT_VARIABLE __CMAKE_CUDA_COMPILER_OUTPUT)
|
||||
|
||||
# Move result from cache to normal variable.
|
||||
|
|
|
@ -46,8 +46,8 @@ if(NOT CMAKE_CXX_COMPILER_WORKS)
|
|||
# Clear result from normal variable.
|
||||
unset(CMAKE_CXX_COMPILER_WORKS)
|
||||
# Puts test result in cache variable.
|
||||
try_compile(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx
|
||||
try_compile(CMAKE_CXX_COMPILER_WORKS
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx
|
||||
OUTPUT_VARIABLE __CMAKE_CXX_COMPILER_OUTPUT)
|
||||
# Move result from cache to normal variable.
|
||||
set(CMAKE_CXX_COMPILER_WORKS ${CMAKE_CXX_COMPILER_WORKS})
|
||||
|
|
|
@ -46,8 +46,8 @@ if(NOT CMAKE_Fortran_COMPILER_WORKS)
|
|||
# Clear result from normal variable.
|
||||
unset(CMAKE_Fortran_COMPILER_WORKS)
|
||||
# Puts test result in cache variable.
|
||||
try_compile(CMAKE_Fortran_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
|
||||
try_compile(CMAKE_Fortran_COMPILER_WORKS
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
# Move result from cache to normal variable.
|
||||
set(CMAKE_Fortran_COMPILER_WORKS ${CMAKE_Fortran_COMPILER_WORKS})
|
||||
|
@ -77,8 +77,8 @@ if(NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90)
|
|||
integer stop ; stop = 1 ; do while ( stop .eq. 0 ) ; end do
|
||||
END PROGRAM TESTFortran90
|
||||
")
|
||||
try_compile(CMAKE_Fortran_COMPILER_SUPPORTS_F90 ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90
|
||||
try_compile(CMAKE_Fortran_COMPILER_SUPPORTS_F90
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
|
||||
message(CHECK_PASS "yes")
|
||||
|
|
|
@ -49,8 +49,8 @@ if(NOT CMAKE_HIP_COMPILER_WORKS)
|
|||
# Clear result from normal variable.
|
||||
unset(CMAKE_HIP_COMPILER_WORKS)
|
||||
# Puts test result in cache variable.
|
||||
try_compile(CMAKE_HIP_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testHIPCompiler.hip
|
||||
try_compile(CMAKE_HIP_COMPILER_WORKS
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testHIPCompiler.hip
|
||||
OUTPUT_VARIABLE __CMAKE_HIP_COMPILER_OUTPUT)
|
||||
# Move result from cache to normal variable.
|
||||
set(CMAKE_HIP_COMPILER_WORKS ${CMAKE_HIP_COMPILER_WORKS})
|
||||
|
|
|
@ -50,8 +50,8 @@ if(NOT CMAKE_OBJC_COMPILER_WORKS)
|
|||
# Clear result from normal variable.
|
||||
unset(CMAKE_OBJC_COMPILER_WORKS)
|
||||
# Puts test result in cache variable.
|
||||
try_compile(CMAKE_OBJC_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testOBJCCompiler.m
|
||||
try_compile(CMAKE_OBJC_COMPILER_WORKS
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testOBJCCompiler.m
|
||||
OUTPUT_VARIABLE __CMAKE_OBJC_COMPILER_OUTPUT)
|
||||
# Move result from cache to normal variable.
|
||||
set(CMAKE_OBJC_COMPILER_WORKS ${CMAKE_OBJC_COMPILER_WORKS})
|
||||
|
|
|
@ -49,8 +49,8 @@ if(NOT CMAKE_OBJCXX_COMPILER_WORKS)
|
|||
# Clear result from normal variable.
|
||||
unset(CMAKE_OBJCXX_COMPILER_WORKS)
|
||||
# Puts test result in cache variable.
|
||||
try_compile(CMAKE_OBJCXX_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testOBJCXXCompiler.mm
|
||||
try_compile(CMAKE_OBJCXX_COMPILER_WORKS
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testOBJCXXCompiler.mm
|
||||
OUTPUT_VARIABLE __CMAKE_OBJCXX_COMPILER_OUTPUT)
|
||||
# Move result from cache to normal variable.
|
||||
set(CMAKE_OBJCXX_COMPILER_WORKS ${CMAKE_OBJCXX_COMPILER_WORKS})
|
||||
|
|
|
@ -26,8 +26,8 @@ if(NOT CMAKE_Swift_COMPILER_WORKS)
|
|||
# Clear result from normal variable.
|
||||
unset(CMAKE_Swift_COMPILER_WORKS)
|
||||
# Puts test result in cache variable.
|
||||
try_compile(CMAKE_Swift_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.swift
|
||||
try_compile(CMAKE_Swift_COMPILER_WORKS
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/main.swift
|
||||
OUTPUT_VARIABLE __CMAKE_Swift_COMPILER_OUTPUT)
|
||||
# Move result from cache to normal variable.
|
||||
set(CMAKE_Swift_COMPILER_WORKS ${CMAKE_Swift_COMPILER_WORKS})
|
||||
|
|
|
@ -68,8 +68,7 @@ macro(CHECK_FORTRAN_FUNCTION_EXISTS FUNCTION VARIABLE)
|
|||
"
|
||||
)
|
||||
try_compile(${VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
|
||||
${CHECK_FUNCTION_EXISTS_ADD_LINK_OPTIONS}
|
||||
${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
|
|
|
@ -90,8 +90,7 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
|
|||
endif()
|
||||
|
||||
try_compile(${VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${_cfe_source}
|
||||
SOURCES ${_cfe_source}
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
${CHECK_FUNCTION_EXISTS_ADD_LINK_OPTIONS}
|
||||
${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}
|
||||
|
|
|
@ -93,8 +93,7 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
|
|||
endif()
|
||||
|
||||
try_compile(${VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
${_CIF_LINK_OPTIONS}
|
||||
${_CIF_LINK_LIBRARIES}
|
||||
|
|
|
@ -92,8 +92,7 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
|
|||
endif()
|
||||
|
||||
try_compile(${VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
${_CIF_LINK_OPTIONS}
|
||||
${_CIF_LINK_LIBRARIES}
|
||||
|
|
|
@ -136,8 +136,7 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
|
|||
message(CHECK_START "Looking for ${_description}")
|
||||
endif()
|
||||
try_compile(${VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${src}
|
||||
SOURCES ${src}
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
${_CIF_LINK_OPTIONS}
|
||||
${_CIF_LINK_LIBRARIES}
|
||||
|
|
|
@ -70,8 +70,7 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
|
|||
endif()
|
||||
|
||||
try_compile(${VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${_cle_source}
|
||||
SOURCES ${_cle_source}
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
${CHECK_LIBRARY_EXISTS_LINK_OPTIONS}
|
||||
LINK_LIBRARIES ${CHECK_LIBRARY_EXISTS_LIBRARIES}
|
||||
|
|
|
@ -100,8 +100,7 @@ function(check_prototype_definition _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB
|
|||
file(READ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c _SOURCE)
|
||||
|
||||
try_compile(${_VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
${CHECK_PROTOTYPE_DEFINITION_LINK_OPTIONS}
|
||||
${CHECK_PROTOTYPE_DEFINITION_LIBS}
|
||||
|
|
|
@ -146,8 +146,7 @@ int main(int argc, char** argv)
|
|||
message(CHECK_START "Looking for ${SYMBOL}")
|
||||
endif()
|
||||
try_compile(${VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
"${SOURCEFILE}"
|
||||
SOURCES "${SOURCEFILE}"
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
${CHECK_SYMBOL_EXISTS_LINK_OPTIONS}
|
||||
${CHECK_SYMBOL_EXISTS_LIBS}
|
||||
|
|
|
@ -143,7 +143,7 @@ function(__check_type_size_impl type var map builtin language)
|
|||
# Perform the check.
|
||||
set(bin ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeSize/${var}.bin)
|
||||
configure_file(${__check_type_size_dir}/CheckTypeSize.c.in ${src} @ONLY)
|
||||
try_compile(HAVE_${var} ${CMAKE_BINARY_DIR} ${src}
|
||||
try_compile(HAVE_${var} SOURCES ${src}
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS}
|
||||
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
|
||||
|
|
|
@ -62,8 +62,7 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
|
|||
set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES)
|
||||
endif()
|
||||
try_compile(${VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_ROOT}/Modules/CheckVariableExists.c
|
||||
SOURCES ${CMAKE_ROOT}/Modules/CheckVariableExists.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
${CHECK_VARIABLE_EXISTS_ADD_LINK_OPTIONS}
|
||||
${CHECK_VARIABLE_EXISTS_ADD_LIBRARIES}
|
||||
|
|
|
@ -135,10 +135,10 @@ function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE)
|
|||
"}\n")
|
||||
|
||||
if(CMAKE_CUDA_COMPILER_LOADED) # CUDA as a language
|
||||
try_run(run_result compile_result ${PROJECT_BINARY_DIR} ${file}
|
||||
try_run(run_result compile_result SOURCES ${file}
|
||||
RUN_OUTPUT_VARIABLE compute_capabilities)
|
||||
else()
|
||||
try_run(run_result compile_result ${PROJECT_BINARY_DIR} ${file}
|
||||
try_run(run_result compile_result SOURCES ${file}
|
||||
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CUDA_INCLUDE_DIRS}"
|
||||
LINK_LIBRARIES ${CUDA_LIBRARIES}
|
||||
RUN_OUTPUT_VARIABLE compute_capabilities)
|
||||
|
|
|
@ -238,7 +238,7 @@ function(_HDF5_test_regular_compiler_C success version is_parallel)
|
|||
" fid = H5Fcreate(\"foo.h5\",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);\n"
|
||||
" return 0;\n"
|
||||
"}")
|
||||
try_compile(${success} ${scratch_directory} ${test_file}
|
||||
try_compile(${success} SOURCES ${test_file}
|
||||
COPY_FILE ${scratch_directory}/compiler_has_h5_c
|
||||
)
|
||||
endif()
|
||||
|
@ -286,7 +286,7 @@ function(_HDF5_test_regular_compiler_CXX success version is_parallel)
|
|||
" H5File file(\"foo.h5\", H5F_ACC_TRUNC);\n"
|
||||
" return 0;\n"
|
||||
"}")
|
||||
try_compile(${success} ${scratch_directory} ${test_file}
|
||||
try_compile(${success} SOURCES ${test_file}
|
||||
COPY_FILE ${scratch_directory}/compiler_has_h5_cxx
|
||||
)
|
||||
endif()
|
||||
|
@ -323,7 +323,7 @@ function(_HDF5_test_regular_compiler_Fortran success is_parallel)
|
|||
" call h5open_f(error)\n"
|
||||
" call h5close_f(error)\n"
|
||||
"end\n")
|
||||
try_compile(${success} ${scratch_directory} ${test_file})
|
||||
try_compile(${success} SOURCES ${test_file})
|
||||
if(${success})
|
||||
execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -showconfig
|
||||
OUTPUT_VARIABLE config_output
|
||||
|
|
|
@ -34,8 +34,7 @@ if(MFC_ATTEMPT_TRY_COMPILE)
|
|||
message(CHECK_START "Looking for MFC")
|
||||
# Try both shared and static as the root project may have set the /MT flag
|
||||
try_compile(MFC_HAVE_MFC
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
|
||||
CMAKE_FLAGS
|
||||
-DCMAKE_MFC_FLAG:STRING=2
|
||||
-DCOMPILE_DEFINITIONS:STRING=-D_AFXDLL
|
||||
|
@ -44,8 +43,7 @@ if(MFC_ATTEMPT_TRY_COMPILE)
|
|||
configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx)
|
||||
try_compile(MFC_HAVE_MFC
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
|
||||
CMAKE_FLAGS
|
||||
-DCMAKE_MFC_FLAG:STRING=1
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
|
|
|
@ -1259,7 +1259,7 @@ function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY SUPPRE
|
|||
endif()
|
||||
if(RUN_BINARY)
|
||||
try_run(MPI_RUN_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}
|
||||
"${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}"
|
||||
SOURCES "${MPI_TEST_SOURCE_FILE}"
|
||||
COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS}
|
||||
LINK_LIBRARIES MPI::MPI_${LANG}
|
||||
RUN_OUTPUT_VARIABLE MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}
|
||||
|
@ -1267,7 +1267,7 @@ function(_MPI_try_staged_settings LANG MPI_TEST_FILE_NAME MODE RUN_BINARY SUPPRE
|
|||
set(MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE} "${MPI_RUN_OUTPUT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}}" PARENT_SCOPE)
|
||||
else()
|
||||
try_compile(MPI_RESULT_${LANG}_${MPI_TEST_FILE_NAME}_${MODE}
|
||||
"${CMAKE_BINARY_DIR}" SOURCES "${MPI_TEST_SOURCE_FILE}"
|
||||
SOURCES "${MPI_TEST_SOURCE_FILE}"
|
||||
COMPILE_DEFINITIONS ${MPI_TEST_COMPILE_DEFINITIONS}
|
||||
LINK_LIBRARIES MPI::MPI_${LANG}
|
||||
COPY_FILE "${BIN_FILE}"
|
||||
|
|
|
@ -187,7 +187,7 @@ function(_OPENACC_GET_FLAGS LANG FLAG_VAR)
|
|||
_OPENACC_WRITE_SOURCE_FILE("${LANG}" "TEST_SOURCE" OpenACCTryFlag _OPENACC_TEST_SRC)
|
||||
|
||||
foreach(FLAG IN LISTS FLAG_CANDIDATES)
|
||||
try_compile(OpenACC_FLAG_TEST_RESULT ${CMAKE_BINARY_DIR} ${_OPENACC_TEST_SRC}
|
||||
try_compile(OpenACC_FLAG_TEST_RESULT SOURCES ${_OPENACC_TEST_SRC}
|
||||
CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${FLAG}"
|
||||
OUTPUT_VARIABLE OpenACC_TRY_COMPILE_OUTPUT
|
||||
)
|
||||
|
@ -215,7 +215,7 @@ function(_OPENACC_GET_SPEC_DATE LANG SPEC_DATE)
|
|||
_OPENACC_WRITE_SOURCE_FILE("${LANG}" "CHECK_VERSION_SOURCE" OpenACCCheckVersion _OPENACC_TEST_SRC)
|
||||
|
||||
set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindOpenACC/accver_${LANG}.bin")
|
||||
try_compile(OpenACC_SPECTEST_${LANG} "${CMAKE_BINARY_DIR}" "${_OPENACC_TEST_SRC}"
|
||||
try_compile(OpenACC_SPECTEST_${LANG} SOURCES "${_OPENACC_TEST_SRC}"
|
||||
CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OpenACC_${LANG}_FLAGS}"
|
||||
COPY_FILE ${BIN_FILE}
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
|
|
|
@ -214,7 +214,8 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
|
|||
string(APPEND OPENMP_FLAGS_TEST " ${OpenMP_VERBOSE_COMPILE_OPTIONS}")
|
||||
endif()
|
||||
string(REGEX REPLACE "[-/=+]" "" OPENMP_PLAIN_FLAG "${OPENMP_FLAG}")
|
||||
try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG} ${CMAKE_BINARY_DIR} ${_OPENMP_TEST_SRC}
|
||||
try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG}
|
||||
SOURCES ${_OPENMP_TEST_SRC}
|
||||
CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OPENMP_FLAGS_TEST}"
|
||||
LINK_LIBRARIES ${CMAKE_${LANG}_VERBOSE_FLAG}
|
||||
OUTPUT_VARIABLE OpenMP_TRY_COMPILE_OUTPUT
|
||||
|
@ -311,7 +312,8 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
|
|||
# Try without specifying include directory first. We only want to
|
||||
# explicitly add a search path if the header can't be found on the
|
||||
# default header search path already.
|
||||
try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG} ${CMAKE_BINARY_DIR} ${_OPENMP_TEST_SRC}
|
||||
try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG}
|
||||
SOURCES ${_OPENMP_TEST_SRC}
|
||||
CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OPENMP_FLAGS_TEST}"
|
||||
LINK_LIBRARIES ${CMAKE_${LANG}_VERBOSE_FLAG} ${OpenMP_libomp_LIBRARY}
|
||||
OUTPUT_VARIABLE OpenMP_TRY_COMPILE_OUTPUT
|
||||
|
@ -321,7 +323,8 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
|
|||
mark_as_advanced(OpenMP_${LANG}_INCLUDE_DIR)
|
||||
set(OpenMP_${LANG}_INCLUDE_DIR "${OpenMP_${LANG}_INCLUDE_DIR}" PARENT_SCOPE)
|
||||
if(OpenMP_${LANG}_INCLUDE_DIR)
|
||||
try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG} ${CMAKE_BINARY_DIR} ${_OPENMP_TEST_SRC}
|
||||
try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG}
|
||||
SOURCES ${_OPENMP_TEST_SRC}
|
||||
CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OPENMP_FLAGS_TEST}"
|
||||
"-DINCLUDE_DIRECTORIES:STRING=${OpenMP_${LANG}_INCLUDE_DIR}"
|
||||
LINK_LIBRARIES ${CMAKE_${LANG}_VERBOSE_FLAG} ${OpenMP_libomp_LIBRARY}
|
||||
|
@ -343,7 +346,8 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
|
|||
)
|
||||
mark_as_advanced(OpenMP_libomp_LIBRARY)
|
||||
if(OpenMP_libomp_LIBRARY)
|
||||
try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG} ${CMAKE_BINARY_DIR} ${_OPENMP_TEST_SRC}
|
||||
try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG}
|
||||
SOURCES ${_OPENMP_TEST_SRC}
|
||||
CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OPENMP_FLAGS_TEST}"
|
||||
LINK_LIBRARIES ${CMAKE_${LANG}_VERBOSE_FLAG} ${OpenMP_libomp_LIBRARY}
|
||||
OUTPUT_VARIABLE OpenMP_TRY_COMPILE_OUTPUT
|
||||
|
@ -414,7 +418,8 @@ function(_OPENMP_GET_SPEC_DATE LANG SPEC_DATE)
|
|||
|
||||
set(BIN_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindOpenMP/ompver_${LANG}.bin")
|
||||
string(REGEX REPLACE "[-/=+]" "" OPENMP_PLAIN_FLAG "${OPENMP_FLAG}")
|
||||
try_compile(OpenMP_SPECTEST_${LANG}_${OPENMP_PLAIN_FLAG} "${CMAKE_BINARY_DIR}" "${_OPENMP_TEST_SRC}"
|
||||
try_compile(OpenMP_SPECTEST_${LANG}_${OPENMP_PLAIN_FLAG}
|
||||
SOURCES "${_OPENMP_TEST_SRC}"
|
||||
CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OpenMP_${LANG}_FLAGS}" ${_includeDirFlags}
|
||||
COPY_FILE ${BIN_FILE}
|
||||
OUTPUT_VARIABLE OpenMP_TRY_COMPILE_OUTPUT)
|
||||
|
|
|
@ -135,8 +135,7 @@ macro(_threads_check_flag_pthread)
|
|||
configure_file(${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c "${_threads_src}" COPYONLY)
|
||||
endif()
|
||||
try_compile(THREADS_HAVE_PTHREAD_ARG
|
||||
${CMAKE_BINARY_DIR}
|
||||
${_threads_src}
|
||||
SOURCES ${_threads_src}
|
||||
CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread
|
||||
OUTPUT_VARIABLE _cmake_check_pthreads_output)
|
||||
|
||||
|
|
|
@ -93,8 +93,7 @@ function(CMAKE_CHECK_SOURCE_COMPILES _lang _source _var)
|
|||
message(CHECK_START "Performing Test ${_var}")
|
||||
endif()
|
||||
try_compile(${_var}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
|
||||
COMPILE_DEFINITIONS -D${_var} ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
${CHECK_${LANG}_SOURCE_COMPILES_ADD_LINK_OPTIONS}
|
||||
${CHECK_${LANG}_SOURCE_COMPILES_ADD_LIBRARIES}
|
||||
|
|
|
@ -92,8 +92,7 @@ function(CMAKE_CHECK_SOURCE_RUNS _lang _source _var)
|
|||
message(CHECK_START "Performing Test ${_var}")
|
||||
endif()
|
||||
try_run(${_var}_EXITCODE ${_var}_COMPILED
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
|
||||
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
|
||||
COMPILE_DEFINITIONS -D${_var} ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
${CHECK_${_lang}_SOURCE_COMPILES_ADD_LINK_OPTIONS}
|
||||
${CHECK_${_lang}_SOURCE_COMPILES_ADD_LIBRARIES}
|
||||
|
|
|
@ -31,7 +31,7 @@ macro(_record_compiler_features lang compile_flags feature_list)
|
|||
endif()
|
||||
|
||||
try_compile(CMAKE_${lang}_FEATURE_TEST
|
||||
${CMAKE_BINARY_DIR} "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}"
|
||||
SOURCES "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}"
|
||||
COMPILE_DEFINITIONS "${compile_flags}"
|
||||
LINK_LIBRARIES "${compile_flags_for_link}"
|
||||
OUTPUT_VARIABLE _output
|
||||
|
|
|
@ -89,8 +89,7 @@ macro(__TEST_BIG_ENDIAN_LEGACY_IMPL VARIABLE)
|
|||
file(READ ${_test_file} TEST_ENDIANESS_FILE_CONTENT)
|
||||
|
||||
try_compile(HAVE_${VARIABLE}
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
${_test_file}
|
||||
SOURCES ${_test_file}
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
COPY_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin" )
|
||||
|
||||
|
|
|
@ -25,8 +25,7 @@ macro(CHECK_CXX_ACCEPTS_FLAG FLAGS VARIABLE)
|
|||
if(NOT DEFINED ${VARIABLE})
|
||||
message(CHECK_START "Checking to see if CXX compiler accepts flag ${FLAGS}")
|
||||
try_compile(${VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_ROOT}/Modules/DummyCXXFile.cxx
|
||||
SOURCES ${CMAKE_ROOT}/Modules/DummyCXXFile.cxx
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${FLAGS}
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
if(${VARIABLE})
|
||||
|
|
|
@ -17,8 +17,8 @@ for-init-statement to the loop body.
|
|||
|
||||
if(NOT DEFINED CMAKE_ANSI_FOR_SCOPE)
|
||||
message(CHECK_START "Check for ANSI scope")
|
||||
try_compile(CMAKE_ANSI_FOR_SCOPE ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx
|
||||
try_compile(CMAKE_ANSI_FOR_SCOPE
|
||||
SOURCES ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
if (CMAKE_ANSI_FOR_SCOPE)
|
||||
message(CHECK_PASS "found")
|
||||
|
|
|
@ -16,8 +16,8 @@ check if the compiler supports the standard ANSI sstream header
|
|||
|
||||
if(NOT DEFINED CMAKE_HAS_ANSI_STRING_STREAM)
|
||||
message(CHECK_START "Check for sstream")
|
||||
try_compile(CMAKE_HAS_ANSI_STRING_STREAM ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_ROOT}/Modules/TestForSSTREAM.cxx
|
||||
try_compile(CMAKE_HAS_ANSI_STRING_STREAM
|
||||
SOURCES ${CMAKE_ROOT}/Modules/TestForSSTREAM.cxx
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
if (CMAKE_HAS_ANSI_STRING_STREAM)
|
||||
message(CHECK_PASS "found")
|
||||
|
|
|
@ -16,8 +16,8 @@ check if the compiler supports std:: on stl classes
|
|||
|
||||
if(NOT DEFINED CMAKE_STD_NAMESPACE)
|
||||
message(CHECK_START "Check for STD namespace")
|
||||
try_compile(CMAKE_STD_NAMESPACE ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx
|
||||
try_compile(CMAKE_STD_NAMESPACE
|
||||
SOURCES ${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
if (CMAKE_STD_NAMESPACE)
|
||||
message(CHECK_PASS "found")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
^(CMake Warning in [^
|
||||
]*/Tests/RunCMake/CUDA_architectures/architectures-suffix-build/CMakeFiles/CMakeTmp/CMakeLists.txt:
|
||||
]*/Tests/RunCMake/CUDA_architectures/architectures-suffix-build/CMakeFiles/CMakeScratch/TryCompile-[^/]*/CMakeLists.txt:
|
||||
Clang doesn't support disabling CUDA real code generation.
|
||||
*)*$
|
||||
|
|
|
@ -978,6 +978,8 @@ set(RunCMake_TEST_OPTIONS --debug-trycompile)
|
|||
run_cmake(debug-trycompile)
|
||||
unset(RunCMake_TEST_OPTIONS)
|
||||
|
||||
run_cmake(trycompile-clean)
|
||||
|
||||
function(run_cmake_depends)
|
||||
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_SOURCE_DIR}/cmake_depends")
|
||||
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/cmake_depends-build")
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
enable_language(C)
|
||||
|
||||
# Look for a source tree left by enable_language internal checks.
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/CMakeLists.txt)
|
||||
set(scratch ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeScratch)
|
||||
file(GLOB_RECURSE remnants ${scratch}/TryCompile-*/CMakeLists.txt)
|
||||
if(NOT remnants)
|
||||
message(FATAL_ERROR "--debug-trycompile should leave the source behind")
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
enable_language(C)
|
||||
|
||||
# Look for a source tree left by enable_language internal checks.
|
||||
set(scratch ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeScratch)
|
||||
file(GLOB_RECURSE remnants ${scratch}/TryCompile-*/*)
|
||||
if(remnants)
|
||||
message(FATAL_ERROR "try_compile should not leave artifacts behind")
|
||||
endif()
|
Loading…
Reference in New Issue