Uploaded Test files
This commit is contained in:
parent
f584ad9d97
commit
2e81cb7d99
16627 changed files with 2065359 additions and 102444 deletions
|
@ -0,0 +1,28 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
AddFileDependencies
|
||||
-------------------
|
||||
|
||||
Add dependencies to a source file.
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
ADD_FILE_DEPENDENCIES(<source> <files>)
|
||||
|
||||
Adds the given ``<files>`` to the dependencies of file ``<source>``.
|
||||
#]=======================================================================]
|
||||
|
||||
macro(ADD_FILE_DEPENDENCIES _file)
|
||||
|
||||
get_source_file_property(_deps ${_file} OBJECT_DEPENDS)
|
||||
if (_deps)
|
||||
set(_deps ${_deps} ${ARGN})
|
||||
else ()
|
||||
set(_deps ${ARGN})
|
||||
endif ()
|
||||
|
||||
set_source_files_properties(${_file} PROPERTIES OBJECT_DEPENDS "${_deps}")
|
||||
|
||||
endmacro()
|
|
@ -0,0 +1,162 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[======================================================================[.rst:
|
||||
AndroidTestUtilities
|
||||
------------------------
|
||||
|
||||
Create a test that automatically loads specified data onto an Android device.
|
||||
|
||||
Introduction
|
||||
^^^^^^^^^^^^
|
||||
|
||||
Use this module to push data needed for testing an Android device behavior
|
||||
onto a connected Android device. The module will accept files and libraries as
|
||||
well as separate destinations for each. It will create a test that loads the
|
||||
files into a device object store and link to them from the specified
|
||||
destination. The files are only uploaded if they are not already in the object
|
||||
store.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
include(AndroidTestUtilities)
|
||||
android_add_test_data(
|
||||
example_setup_test
|
||||
FILES <files>...
|
||||
LIBS <libs>...
|
||||
DEVICE_TEST_DIR "/data/local/tests/example"
|
||||
DEVICE_OBJECT_STORE "/sdcard/.ExternalData/SHA"
|
||||
)
|
||||
|
||||
|
||||
At build time a test named "example_setup_test" will be created. Run this test
|
||||
on the command line with :manual:`ctest(1)` to load the data onto the Android
|
||||
device.
|
||||
|
||||
Module Functions
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
.. command:: android_add_test_data
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
android_add_test_data(<test-name>
|
||||
[FILES <files>...] [FILES_DEST <device-dir>]
|
||||
[LIBS <libs>...] [LIBS_DEST <device-dir>]
|
||||
[DEVICE_OBJECT_STORE <device-dir>]
|
||||
[DEVICE_TEST_DIR <device-dir>]
|
||||
[NO_LINK_REGEX <strings>...]
|
||||
)
|
||||
|
||||
The ``android_add_test_data`` function is used to copy files and libraries
|
||||
needed to run project-specific tests. On the host operating system, this is
|
||||
done at build time. For on-device testing, the files are loaded onto the
|
||||
device by the manufactured test at run time.
|
||||
|
||||
This function accepts the following named parameters:
|
||||
|
||||
``FILES <files>...``
|
||||
zero or more files needed for testing
|
||||
``LIBS <libs>...``
|
||||
zero or more libraries needed for testing
|
||||
``FILES_DEST <device-dir>``
|
||||
absolute path where the data files are expected to be
|
||||
``LIBS_DEST <device-dir>``
|
||||
absolute path where the libraries are expected to be
|
||||
``DEVICE_OBJECT_STORE <device-dir>``
|
||||
absolute path to the location where the data is stored on-device
|
||||
``DEVICE_TEST_DIR <device-dir>``
|
||||
absolute path to the root directory of the on-device test location
|
||||
``NO_LINK_REGEX <strings>...``
|
||||
list of regex strings matching the names of files that should be
|
||||
copied from the object store to the testing directory
|
||||
#]======================================================================]
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/ExternalData.cmake)
|
||||
|
||||
# The parameters to this function should be set to the list of directories,
|
||||
# files, and libraries that need to be installed prior to testing.
|
||||
function(android_add_test_data test_name)
|
||||
# As the names suggest, oneValueArgs lists the arguments that specify a
|
||||
# single value, while multiValueArgs can contain one or more values.
|
||||
set(keywordArgs)
|
||||
set(oneValueArgs FILES_DEST LIBS_DEST DEVICE_OBJECT_STORE DEVICE_TEST_DIR)
|
||||
set(multiValueArgs FILES LIBS NO_LINK_REGEX)
|
||||
|
||||
# For example, if you called this function with FILES </path/to/file>
|
||||
# then this path would be stored in the variable AST_FILES.
|
||||
# The AST prefix stands for the name of this function (android_add_test_data).
|
||||
cmake_parse_arguments(AST "${keywordArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
if(NOT AST_DEVICE_TEST_DIR)
|
||||
message(FATAL_ERROR "-- You must specify the location of the on device test directory.")
|
||||
endif()
|
||||
if(NOT AST_DEVICE_OBJECT_STORE)
|
||||
message(FATAL_ERROR "-- You must specify the location of the on device object store.")
|
||||
endif()
|
||||
if(${AST_DEVICE_TEST_DIR} STREQUAL "/")
|
||||
message(FATAL_ERROR "-- The device test directory cannot be '/'")
|
||||
endif()
|
||||
|
||||
# Copy all test data files into the binary directory, where tests are run.
|
||||
# ExternalData will handle fetching DATA{...} references.
|
||||
string(REPLACE "|" ";" hash_algs "${_ExternalData_REGEX_EXT}")
|
||||
# Convert ExternalData placeholder file names to DATA{} syntax.
|
||||
foreach(alg ${hash_algs})
|
||||
string(REGEX REPLACE "([^ ;]+)\\.${alg}" "DATA{\\1}" AST_FILES "${AST_FILES}")
|
||||
endforeach()
|
||||
|
||||
set(DATA_TARGET_NAME "${test_name}")
|
||||
string(FIND "${AST_FILES}" "DATA{" data_files_found)
|
||||
if(${data_files_found} GREATER "-1")
|
||||
# Use ExternalData if any DATA{} files were found.
|
||||
ExternalData_Expand_Arguments(
|
||||
${DATA_TARGET_NAME}
|
||||
extern_data_output
|
||||
${AST_FILES})
|
||||
ExternalData_Add_Target(${DATA_TARGET_NAME})
|
||||
else()
|
||||
add_custom_target(${DATA_TARGET_NAME} ALL)
|
||||
set(extern_data_output ${AST_FILES})
|
||||
endif()
|
||||
|
||||
# For regular files on Linux, just copy them directly.
|
||||
foreach(path ${AST_FILES})
|
||||
foreach(output ${extern_data_output})
|
||||
if(${output} STREQUAL ${path})
|
||||
# Check if a destination was specified. If not, we copy by default
|
||||
# into this project's binary directory, preserving its relative path.
|
||||
if(AST_${VAR}_DEST)
|
||||
set(DEST ${CMAKE_BINARY_DIR}/${parent_dir}/${AST_${VAR}_DEST})
|
||||
else()
|
||||
get_filename_component(parent_dir ${path} DIRECTORY)
|
||||
set(DEST "${CMAKE_BINARY_DIR}/${parent_dir}")
|
||||
endif()
|
||||
get_filename_component(extern_data_source ${output} REALPATH)
|
||||
get_filename_component(extern_data_basename ${output} NAME)
|
||||
add_custom_command(
|
||||
TARGET ${DATA_TARGET_NAME} POST_BUILD
|
||||
DEPENDS ${extern_data_source}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${extern_data_source} ${DEST}/${extern_data_basename}
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
if(ANDROID)
|
||||
string(REGEX REPLACE "DATA{([^ ;]+)}" "\\1" processed_FILES "${AST_FILES}")
|
||||
add_test(
|
||||
NAME ${test_name}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-Darg_files_dest=${AST_FILES_DEST}"
|
||||
"-Darg_libs_dest=${AST_LIBS_DEST}"
|
||||
"-Darg_dev_test_dir=${AST_DEVICE_TEST_DIR}"
|
||||
"-Darg_dev_obj_store=${AST_DEVICE_OBJECT_STORE}"
|
||||
"-Darg_no_link_regex=${AST_NO_LINK_REGEX}"
|
||||
"-Darg_files=${processed_FILES}"
|
||||
"-Darg_libs=${AST_LIBS}"
|
||||
"-Darg_src_dir=${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
-P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/AndroidTestUtilities/PushToAndroidDevice.cmake)
|
||||
endif()
|
||||
endfunction()
|
|
@ -0,0 +1,176 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
# This function handles pushing all of the test files needed to the device.
|
||||
# It places the data files in the object store and makes links to them from
|
||||
# the appropriate directories.
|
||||
#
|
||||
# This function accepts the following named parameters:
|
||||
# DIRS : one or more directories needed for testing.
|
||||
# FILES : one or more files needed for testing.
|
||||
# LIBS : one or more libraries needed for testing.
|
||||
# DIRS_DEST : specify where the directories should be installed.
|
||||
# FILES_DEST : specify where the files should be installed.
|
||||
# LIBS_DEST : specify where the libraries should be installed.
|
||||
# DEV_OBJ_STORE : specify where the actual data files should be placed.
|
||||
# DEV_TEST_DIR : specify the root file for the module test directory.
|
||||
# The DEV_OBJ_STORE and DEV_TEST_DIR variables are required.
|
||||
|
||||
# The parameters to this function should be set to the list of directories,
|
||||
# files, and libraries that need to be installed prior to testing.
|
||||
function(android_push_test_files_to_device)
|
||||
|
||||
# The functions in the module need the adb executable.
|
||||
find_program(adb_executable adb)
|
||||
if(NOT adb_executable)
|
||||
message(FATAL_ERROR "could not find adb")
|
||||
endif()
|
||||
|
||||
function(execute_adb_command)
|
||||
execute_process(COMMAND ${adb_executable} ${ARGN} RESULT_VARIABLE res_var OUTPUT_VARIABLE out_var ERROR_VARIABLE err_var)
|
||||
set(out_var ${out_var} PARENT_SCOPE)
|
||||
if(res_var)
|
||||
string(REGEX REPLACE ";" " " com "${ARGN}")
|
||||
message(FATAL_ERROR "Error occurred during adb command: adb ${com}\nError: ${err_var}.")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Checks to make sure that a given file exists on the device. If it does,
|
||||
# if(file_exists) will return true.
|
||||
macro(check_device_file_exists device_file file_exists)
|
||||
set(${file_exists} "")
|
||||
execute_process(
|
||||
COMMAND ${adb_executable} shell ls ${device_file}
|
||||
OUTPUT_VARIABLE out_var ERROR_VARIABLE out_var)
|
||||
if(NOT out_var) # when a directory exists but is empty the output is empty
|
||||
set(${file_exists} "YES")
|
||||
else()
|
||||
string(FIND ${out_var} "No such file or directory" no_file_exists)
|
||||
if(${no_file_exists} STREQUAL "-1") # -1 means the file exists
|
||||
set(${file_exists} "YES")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Checks to see if a filename matches a regex.
|
||||
function(filename_regex filename reg_ex)
|
||||
string(REGEX MATCH ${reg_ex} filename_match ${filename})
|
||||
set(filename_match ${filename_match} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# If a file with given name exists in the CMAKE_BINARY_DIR then use that file.
|
||||
# Otherwise use the file with root in CMAKE_CURRENT_SOURCE_DIR.
|
||||
macro(set_absolute_path relative_path absolute_path)
|
||||
set(${absolute_path} ${arg_src_dir}/${relative_path})
|
||||
if(EXISTS ${CMAKE_BINARY_DIR}/${relative_path})
|
||||
set(${absolute_path} ${CMAKE_BINARY_DIR}/${relative_path})
|
||||
endif()
|
||||
if(NOT EXISTS ${${absolute_path}})
|
||||
if(EXISTS ${relative_path})
|
||||
set(${absolute_path} ${relative_path})
|
||||
else()
|
||||
message(FATAL_ERROR "Cannot find file for specified path: ${relative_path}")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# This function pushes the data into the device object store and
|
||||
# creates a link to that data file in a specified location.
|
||||
#
|
||||
# This function requires the following un-named parameters:
|
||||
# data_path : absolute path to data to load into dev obj store.
|
||||
# dev_object_store : absolute path to the device object store directory.
|
||||
# link_origin : absolute path to the origin of the link to the dev obj store data file.
|
||||
function(push_and_link data_path dev_object_store link_origin)
|
||||
FILE(SHA1 ${data_path} hash_val)
|
||||
set(obj_store_dst ${dev_object_store}/${hash_val})
|
||||
check_device_file_exists(${obj_store_dst} obj_store_file_exists)
|
||||
# TODO: Verify that the object store file is indeed hashed correctly. Could use md5.
|
||||
if(NOT obj_store_file_exists)
|
||||
execute_adb_command(push ${data_path} ${obj_store_dst})
|
||||
endif()
|
||||
check_device_file_exists(${link_origin} link_exists)
|
||||
if(link_exists)
|
||||
execute_adb_command(shell rm -f ${link_origin})
|
||||
endif()
|
||||
foreach(ex ${arg_no_link_regex})
|
||||
filename_regex(${data_path} ${ex})
|
||||
LIST(APPEND match_ex ${filename_match})
|
||||
endforeach()
|
||||
if(match_ex)
|
||||
execute_adb_command(shell cp ${obj_store_dst} ${link_origin})
|
||||
else()
|
||||
execute_adb_command(shell ln -s ${obj_store_dst} ${link_origin})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
#--------------------Beginning of actual function----------------------------
|
||||
#----------------------------------------------------------------------------
|
||||
set(oneValueArgs FILES_DEST LIBS_DEST DEV_TEST_DIR DEV_OBJ_STORE)
|
||||
set(multiValueArgs FILES LIBS)
|
||||
cmake_parse_arguments(_ptd "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
# Setup of object store and test dir.
|
||||
check_device_file_exists(${_ptd_DEV_OBJ_STORE} dev_obj_store_exists)
|
||||
if(NOT dev_obj_store_exists)
|
||||
execute_adb_command(shell mkdir -p ${_ptd_DEV_OBJ_STORE})
|
||||
endif()
|
||||
check_device_file_exists(${_ptd_DEV_TEST_DIR} test_dir_exists)
|
||||
if(test_dir_exists)
|
||||
# This is protected in the SetupProjectTests module.
|
||||
execute_adb_command(shell rm -r ${_ptd_DEV_TEST_DIR})
|
||||
endif()
|
||||
execute_adb_command(shell mkdir -p ${_ptd_DEV_TEST_DIR})
|
||||
|
||||
# Looping over the various types of test data possible.
|
||||
foreach(TYPE ${multiValueArgs})
|
||||
if(_ptd_${TYPE})
|
||||
|
||||
# determine if the data type destination has been explicitly specified.
|
||||
if(_ptd_${TYPE}_DEST)
|
||||
set(dest ${_ptd_${TYPE}_DEST})
|
||||
else()
|
||||
if(${TYPE} STREQUAL LIBS)
|
||||
set(dest ${_ptd_DEV_TEST_DIR}/lib)
|
||||
else()
|
||||
set(dest ${_ptd_DEV_TEST_DIR})
|
||||
endif()
|
||||
endif()
|
||||
execute_adb_command(shell mkdir -p ${dest})
|
||||
|
||||
# Loop over the files passed in
|
||||
foreach(relative_path ${_ptd_${TYPE}})
|
||||
# The absolute path can be through the source directory or the build directory.
|
||||
# If the file/dir exists in the build directory that version is chosen.
|
||||
set_absolute_path(${relative_path} absolute_path)
|
||||
# Need to transfer all data files in the data directories to the device
|
||||
# except those explicitly ignored.
|
||||
if(${TYPE} STREQUAL FILES)
|
||||
get_filename_component(file_dir ${relative_path} DIRECTORY)
|
||||
# dest was determined earlier, relative_path is a dir, file is path from relative path to a data
|
||||
set(cur_dest ${dest}/${relative_path})
|
||||
set(on_dev_dir ${dest}/${file_dir})
|
||||
execute_adb_command(shell mkdir -p ${on_dev_dir})
|
||||
if(IS_SYMLINK ${absolute_path})
|
||||
get_filename_component(real_data_origin ${absolute_path} REALPATH)
|
||||
push_and_link(${real_data_origin} ${_ptd_DEV_OBJ_STORE} ${cur_dest})
|
||||
else()
|
||||
push_and_link(${absolute_path} ${_ptd_DEV_OBJ_STORE} ${cur_dest})
|
||||
endif()
|
||||
else() # LIBS
|
||||
execute_adb_command(push ${absolute_path} ${dest})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
android_push_test_files_to_device(
|
||||
FILES_DEST ${arg_files_dest}
|
||||
LIBS_DEST ${arg_libs_dest}
|
||||
DEV_TEST_DIR ${arg_dev_test_dir}
|
||||
DEV_OBJ_STORE ${arg_dev_obj_store}
|
||||
FILES ${arg_files}
|
||||
LIBS ${arg_libs}
|
||||
)
|
|
@ -0,0 +1,37 @@
|
|||
# This is a basic version file for the Config-mode of find_package().
|
||||
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||
# to create a version-file which can be installed along a config.cmake file.
|
||||
#
|
||||
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||
# the requested version string are exactly the same and it sets
|
||||
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
|
||||
# The variable CVF_VERSION must be set before calling configure_file().
|
||||
|
||||
set(PACKAGE_VERSION "@CVF_VERSION@")
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# if the installed project requested no architecture check, don't perform the check
|
||||
if("@CVF_ARCH_INDEPENDENT@")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
|
||||
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
|
@ -0,0 +1,52 @@
|
|||
# This is a basic version file for the Config-mode of find_package().
|
||||
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||
# to create a version-file which can be installed along a config.cmake file.
|
||||
#
|
||||
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||
# the requested version string are exactly the same and it sets
|
||||
# PACKAGE_VERSION_COMPATIBLE if the current version is equal to the requested version.
|
||||
# The tweak version component is ignored.
|
||||
# The variable CVF_VERSION must be set before calling configure_file().
|
||||
|
||||
|
||||
set(PACKAGE_VERSION "@CVF_VERSION@")
|
||||
|
||||
if("@CVF_VERSION@" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
|
||||
set(CVF_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
set(CVF_VERSION_NO_TWEAK "@CVF_VERSION@")
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version
|
||||
set(REQUESTED_VERSION_NO_TWEAK "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
set(REQUESTED_VERSION_NO_TWEAK "${PACKAGE_FIND_VERSION}")
|
||||
endif()
|
||||
|
||||
if(REQUESTED_VERSION_NO_TWEAK STREQUAL CVF_VERSION_NO_TWEAK)
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
|
||||
|
||||
# if the installed project requested no architecture check, don't perform the check
|
||||
if("@CVF_ARCH_INDEPENDENT@")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
|
||||
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
|
@ -0,0 +1,51 @@
|
|||
# This is a basic version file for the Config-mode of find_package().
|
||||
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||
# to create a version-file which can be installed along a config.cmake file.
|
||||
#
|
||||
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||
# the requested version string are exactly the same and it sets
|
||||
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
|
||||
# but only if the requested major version is the same as the current one.
|
||||
# The variable CVF_VERSION must be set before calling configure_file().
|
||||
|
||||
|
||||
set(PACKAGE_VERSION "@CVF_VERSION@")
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
||||
if("@CVF_VERSION@" MATCHES "^([0-9]+)\\.")
|
||||
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
set(CVF_VERSION_MAJOR "@CVF_VERSION@")
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# if the installed project requested no architecture check, don't perform the check
|
||||
if("@CVF_ARCH_INDEPENDENT@")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
|
||||
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
|
@ -0,0 +1,55 @@
|
|||
# This is a basic version file for the Config-mode of find_package().
|
||||
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||
# to create a version-file which can be installed along a config.cmake file.
|
||||
#
|
||||
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||
# the requested version string are exactly the same and it sets
|
||||
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
|
||||
# but only if the requested major and minor versions are the same as the current
|
||||
# one.
|
||||
# The variable CVF_VERSION must be set before calling configure_file().
|
||||
|
||||
|
||||
set(PACKAGE_VERSION "@CVF_VERSION@")
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
||||
if("@CVF_VERSION@" MATCHES "^([0-9]+)\\.([0-9]+)")
|
||||
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
set(CVF_VERSION_MINOR "${CMAKE_MATCH_2}")
|
||||
else()
|
||||
set(CVF_VERSION_MAJOR "@CVF_VERSION@")
|
||||
set(CVF_VERSION_MINOR "")
|
||||
endif()
|
||||
|
||||
if((PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) AND
|
||||
(PACKAGE_FIND_VERSION_MINOR STREQUAL CVF_VERSION_MINOR))
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# if the installed project requested no architecture check, don't perform the check
|
||||
if("@CVF_ARCH_INDEPENDENT@")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
|
||||
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,7 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This file is used by cmake.cxx to compute the CMAKE_ROOT location.
|
||||
# Do not remove this file from cvs without updating cmake.cxx to look
|
||||
# for a different file.
|
|
@ -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.
|
||||
|
||||
|
||||
# support for AT&T syntax assemblers, e.g. GNU as
|
||||
|
||||
set(ASM_DIALECT "-ATT")
|
||||
# *.S files are supposed to be preprocessed, so they should not be passed to
|
||||
# assembler but should be processed by gcc
|
||||
set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;asm)
|
||||
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
|
||||
|
||||
include(CMakeASMInformation)
|
||||
set(ASM_DIALECT)
|
|
@ -0,0 +1,20 @@
|
|||
set(CMAKE_ASM@ASM_DIALECT@_COMPILER "@_CMAKE_ASM_COMPILER@")
|
||||
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ARG1 "@_CMAKE_ASM_COMPILER_ARG1@")
|
||||
set(CMAKE_AR "@CMAKE_AR@")
|
||||
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_AR "@_CMAKE_ASM_COMPILER_AR@")
|
||||
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
|
||||
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_RANLIB "@_CMAKE_ASM_COMPILER_RANLIB@")
|
||||
set(CMAKE_LINKER "@CMAKE_LINKER@")
|
||||
set(CMAKE_MT "@CMAKE_MT@")
|
||||
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1)
|
||||
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ID "@_CMAKE_ASM_COMPILER_ID@")
|
||||
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_VERSION "@_CMAKE_ASM_COMPILER_VERSION@")
|
||||
set(CMAKE_ASM@ASM_DIALECT@_COMPILER_ENV_VAR "@_CMAKE_ASM_COMPILER_ENV_VAR@")
|
||||
@_SET_CMAKE_ASM_COMPILER_ID_VENDOR_MATCH@
|
||||
@_SET_CMAKE_ASM_COMPILER_ARCHITECTURE_ID@
|
||||
@_SET_CMAKE_ASM_COMPILER_SYSROOT@
|
||||
|
||||
set(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||
set(CMAKE_ASM@ASM_DIALECT@_LINKER_PREFERENCE 0)
|
||||
|
||||
@CMAKE_ASM_COMPILER_CUSTOM_CODE@
|
|
@ -0,0 +1,110 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
if(UNIX)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o)
|
||||
else()
|
||||
set(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .obj)
|
||||
endif()
|
||||
|
||||
set(CMAKE_INCLUDE_FLAG_ASM${ASM_DIALECT} "-I") # -I
|
||||
set(CMAKE_BASE_NAME)
|
||||
get_filename_component(CMAKE_BASE_NAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME_WE)
|
||||
|
||||
if("${CMAKE_BASE_NAME}" STREQUAL "as")
|
||||
set(CMAKE_BASE_NAME gas)
|
||||
endif()
|
||||
|
||||
# Load compiler-specific information.
|
||||
set(_INCLUDED_FILE "")
|
||||
if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||
include(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif()
|
||||
if(NOT _INCLUDED_FILE)
|
||||
if("ASM${ASM_DIALECT}" STREQUAL "ASM")
|
||||
message(STATUS "Warning: Did not find file Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}")
|
||||
endif()
|
||||
include(Platform/${CMAKE_BASE_NAME} OPTIONAL)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
if(NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
if(NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
|
||||
endif()
|
||||
|
||||
# This should be included before the _INIT variables are
|
||||
# used to initialize the cache. Since the rule variables
|
||||
# have if blocks on them, users can still define them here.
|
||||
# But, it should still be after the platform file so changes can
|
||||
# be made to those values.
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE)
|
||||
# Save the full path of the file so try_compile can use it.
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM)
|
||||
# Save the full path of the file so try_compile can use it.
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE_ASM} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM "${_override}")
|
||||
endif()
|
||||
|
||||
# Set default assembler file extensions:
|
||||
if(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm)
|
||||
endif()
|
||||
|
||||
|
||||
# Support for CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT and friends:
|
||||
set(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}")
|
||||
|
||||
cmake_initialize_per_config_variable(CMAKE_ASM${ASM_DIALECT}_FLAGS "Flags used by the ASM${ASM_DIALECT} compiler")
|
||||
|
||||
if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY
|
||||
"<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
|
||||
"<CMAKE_RANLIB> <TARGET>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
|
||||
"<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_ASM${ASM_DIALECT}_FLAG})
|
||||
endif()
|
||||
|
||||
# to be done
|
||||
if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_MODULE)
|
||||
endif()
|
||||
|
||||
|
||||
set(CMAKE_ASM${ASM_DIALECT}_INFOMATION_LOADED 1)
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# support for the MS assembler, masm and masm64
|
||||
|
||||
set(ASM_DIALECT "_MASM")
|
||||
|
||||
set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
|
||||
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> /c /Fo <OBJECT> <SOURCE>")
|
||||
|
||||
# The ASM_MASM compiler id for this compiler is "MSVC", so fill out the runtime library table.
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "")
|
||||
|
||||
include(CMakeASMInformation)
|
||||
set(ASM_DIALECT)
|
|
@ -0,0 +1,44 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# support for the nasm assembler
|
||||
|
||||
set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS nasm asm)
|
||||
|
||||
if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT)
|
||||
if(WIN32)
|
||||
if(DEFINED CMAKE_C_SIZEOF_DATA_PTR AND CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(CMAKE_ASM_NASM_OBJECT_FORMAT win64)
|
||||
elseif(DEFINED CMAKE_CXX_SIZEOF_DATA_PTR AND CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(CMAKE_ASM_NASM_OBJECT_FORMAT win64)
|
||||
else()
|
||||
set(CMAKE_ASM_NASM_OBJECT_FORMAT win32)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
if(DEFINED CMAKE_C_SIZEOF_DATA_PTR AND CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(CMAKE_ASM_NASM_OBJECT_FORMAT macho64)
|
||||
elseif(DEFINED CMAKE_CXX_SIZEOF_DATA_PTR AND CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(CMAKE_ASM_NASM_OBJECT_FORMAT macho64)
|
||||
else()
|
||||
set(CMAKE_ASM_NASM_OBJECT_FORMAT macho)
|
||||
endif()
|
||||
else()
|
||||
if(DEFINED CMAKE_C_SIZEOF_DATA_PTR AND CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
|
||||
elseif(DEFINED CMAKE_CXX_SIZEOF_DATA_PTR AND CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
|
||||
else()
|
||||
set(CMAKE_ASM_NASM_OBJECT_FORMAT elf)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_ASM_NASM_COMPILE_OBJECT)
|
||||
set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> <INCLUDES> <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>")
|
||||
endif()
|
||||
|
||||
# Load the generic ASMInformation file:
|
||||
set(ASM_DIALECT "_NASM")
|
||||
include(CMakeASMInformation)
|
||||
set(ASM_DIALECT)
|
|
@ -0,0 +1,194 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
CMakeAddFortranSubdirectory
|
||||
---------------------------
|
||||
|
||||
Add a fortran-only subdirectory, find a fortran compiler, and build.
|
||||
|
||||
The ``cmake_add_fortran_subdirectory`` function adds a subdirectory
|
||||
to a project that contains a fortran-only subproject. The module will
|
||||
check the current compiler and see if it can support fortran. If no
|
||||
fortran compiler is found and the compiler is MSVC, then this module
|
||||
will find the MinGW gfortran. It will then use an external project to
|
||||
build with the MinGW tools. It will also create imported targets for
|
||||
the libraries created. This will only work if the fortran code is
|
||||
built into a dll, so :variable:`BUILD_SHARED_LIBS` is turned on in
|
||||
the project. In addition the :variable:`CMAKE_GNUtoMS` option is set
|
||||
to on, so that Microsoft ``.lib`` files are created. Usage is as follows:
|
||||
|
||||
::
|
||||
|
||||
cmake_add_fortran_subdirectory(
|
||||
<subdir> # name of subdirectory
|
||||
PROJECT <project_name> # project name in subdir top CMakeLists.txt
|
||||
ARCHIVE_DIR <dir> # dir where project places .lib files
|
||||
RUNTIME_DIR <dir> # dir where project places .dll files
|
||||
LIBRARIES <lib>... # names of library targets to import
|
||||
LINK_LIBRARIES # link interface libraries for LIBRARIES
|
||||
[LINK_LIBS <lib> <dep>...]...
|
||||
CMAKE_COMMAND_LINE ... # extra command line flags to pass to cmake
|
||||
NO_EXTERNAL_INSTALL # skip installation of external project
|
||||
)
|
||||
|
||||
Relative paths in ``ARCHIVE_DIR`` and ``RUNTIME_DIR`` are interpreted with
|
||||
respect to the build directory corresponding to the source directory
|
||||
in which the function is invoked.
|
||||
|
||||
Limitations:
|
||||
|
||||
``NO_EXTERNAL_INSTALL`` is required for forward compatibility with a
|
||||
future version that supports installation of the external project
|
||||
binaries during ``make install``.
|
||||
#]=======================================================================]
|
||||
|
||||
include(CheckLanguage)
|
||||
include(ExternalProject)
|
||||
|
||||
function(_setup_mingw_config_and_build source_dir build_dir)
|
||||
# Look for a MinGW gfortran.
|
||||
find_program(MINGW_GFORTRAN
|
||||
NAMES gfortran
|
||||
PATHS
|
||||
c:/MinGW/bin
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin"
|
||||
)
|
||||
if(NOT MINGW_GFORTRAN)
|
||||
message(FATAL_ERROR
|
||||
"gfortran not found, please install MinGW with the gfortran option."
|
||||
"Or set the cache variable MINGW_GFORTRAN to the full path. "
|
||||
" This is required to build")
|
||||
endif()
|
||||
|
||||
# Validate the MinGW gfortran we found.
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_mingw_target "Target:.*64.*mingw")
|
||||
else()
|
||||
set(_mingw_target "Target:.*mingw32")
|
||||
endif()
|
||||
execute_process(COMMAND "${MINGW_GFORTRAN}" -v
|
||||
ERROR_VARIABLE out ERROR_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT "${out}" MATCHES "${_mingw_target}")
|
||||
string(REPLACE "\n" "\n " out " ${out}")
|
||||
message(FATAL_ERROR
|
||||
"MINGW_GFORTRAN is set to\n"
|
||||
" ${MINGW_GFORTRAN}\n"
|
||||
"which is not a MinGW gfortran for this architecture. "
|
||||
"The output from -v does not match \"${_mingw_target}\":\n"
|
||||
"${out}\n"
|
||||
"Set MINGW_GFORTRAN to a proper MinGW gfortran for this architecture."
|
||||
)
|
||||
endif()
|
||||
|
||||
# Configure scripts to run MinGW tools with the proper PATH.
|
||||
get_filename_component(MINGW_PATH ${MINGW_GFORTRAN} PATH)
|
||||
file(TO_NATIVE_PATH "${MINGW_PATH}" MINGW_PATH)
|
||||
string(REPLACE "\\" "\\\\" MINGW_PATH "${MINGW_PATH}")
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/CMakeAddFortranSubdirectory/config_mingw.cmake.in
|
||||
${build_dir}/config_mingw.cmake
|
||||
@ONLY)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/CMakeAddFortranSubdirectory/build_mingw.cmake.in
|
||||
${build_dir}/build_mingw.cmake
|
||||
@ONLY)
|
||||
endfunction()
|
||||
|
||||
function(_add_fortran_library_link_interface library depend_library)
|
||||
set_target_properties(${library} PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG "${depend_library}")
|
||||
endfunction()
|
||||
|
||||
|
||||
function(cmake_add_fortran_subdirectory subdir)
|
||||
# Parse arguments to function
|
||||
set(options NO_EXTERNAL_INSTALL)
|
||||
set(oneValueArgs PROJECT ARCHIVE_DIR RUNTIME_DIR)
|
||||
set(multiValueArgs LIBRARIES LINK_LIBRARIES CMAKE_COMMAND_LINE)
|
||||
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
if(NOT ARGS_NO_EXTERNAL_INSTALL)
|
||||
message(FATAL_ERROR
|
||||
"Option NO_EXTERNAL_INSTALL is required (for forward compatibility) "
|
||||
"but was not given."
|
||||
)
|
||||
endif()
|
||||
|
||||
# if we are not using MSVC without fortran support
|
||||
# then just use the usual add_subdirectory to build
|
||||
# the fortran library
|
||||
check_language(Fortran)
|
||||
if(NOT (MSVC AND (NOT CMAKE_Fortran_COMPILER)))
|
||||
add_subdirectory(${subdir})
|
||||
return()
|
||||
endif()
|
||||
|
||||
# if we have MSVC without Intel fortran then setup
|
||||
# external projects to build with mingw fortran
|
||||
|
||||
set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}")
|
||||
set(project_name "${ARGS_PROJECT}")
|
||||
set(library_dir "${ARGS_ARCHIVE_DIR}")
|
||||
set(binary_dir "${ARGS_RUNTIME_DIR}")
|
||||
set(libraries ${ARGS_LIBRARIES})
|
||||
# use the same directory that add_subdirectory would have used
|
||||
set(build_dir "${CMAKE_CURRENT_BINARY_DIR}/${subdir}")
|
||||
foreach(dir_var library_dir binary_dir)
|
||||
if(NOT IS_ABSOLUTE "${${dir_var}}")
|
||||
get_filename_component(${dir_var}
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${${dir_var}}" ABSOLUTE)
|
||||
endif()
|
||||
endforeach()
|
||||
# create build and configure wrapper scripts
|
||||
_setup_mingw_config_and_build("${source_dir}" "${build_dir}")
|
||||
# create the external project
|
||||
externalproject_add(${project_name}_build
|
||||
SOURCE_DIR ${source_dir}
|
||||
BINARY_DIR ${build_dir}
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND}
|
||||
-P ${build_dir}/config_mingw.cmake
|
||||
BUILD_COMMAND ${CMAKE_COMMAND}
|
||||
-P ${build_dir}/build_mingw.cmake
|
||||
BUILD_ALWAYS 1
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
# create imported targets for all libraries
|
||||
foreach(lib ${libraries})
|
||||
add_library(${lib} SHARED IMPORTED GLOBAL)
|
||||
set_property(TARGET ${lib} APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
|
||||
set_target_properties(${lib} PROPERTIES
|
||||
IMPORTED_IMPLIB_NOCONFIG "${library_dir}/lib${lib}.lib"
|
||||
IMPORTED_LOCATION_NOCONFIG "${binary_dir}/lib${lib}.dll"
|
||||
)
|
||||
add_dependencies(${lib} ${project_name}_build)
|
||||
endforeach()
|
||||
|
||||
# now setup link libraries for targets
|
||||
set(start FALSE)
|
||||
set(target)
|
||||
foreach(lib ${ARGS_LINK_LIBRARIES})
|
||||
if("${lib}" STREQUAL "LINK_LIBS")
|
||||
set(start TRUE)
|
||||
else()
|
||||
if(start)
|
||||
if(DEFINED target)
|
||||
# process current target and target_libs
|
||||
_add_fortran_library_link_interface(${target} "${target_libs}")
|
||||
# zero out target and target_libs
|
||||
set(target)
|
||||
set(target_libs)
|
||||
endif()
|
||||
# save the current target and set start to FALSE
|
||||
set(target ${lib})
|
||||
set(start FALSE)
|
||||
else()
|
||||
# append the lib to target_libs
|
||||
list(APPEND target_libs "${lib}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
# process anything that is left in target and target_libs
|
||||
if(DEFINED target)
|
||||
_add_fortran_library_link_interface(${target} "${target_libs}")
|
||||
endif()
|
||||
endfunction()
|
|
@ -0,0 +1,2 @@
|
|||
set(ENV{PATH} "@MINGW_PATH@\;$ENV{PATH}")
|
||||
execute_process(COMMAND "@CMAKE_COMMAND@" --build . )
|
|
@ -0,0 +1,9 @@
|
|||
set(ENV{PATH} "@MINGW_PATH@\;$ENV{PATH}")
|
||||
set(CMAKE_COMMAND_LINE "@ARGS_CMAKE_COMMAND_LINE@")
|
||||
execute_process(
|
||||
COMMAND "@CMAKE_COMMAND@" "-GMinGW Makefiles"
|
||||
-DCMAKE_Fortran_COMPILER:PATH=@MINGW_GFORTRAN@
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
-DCMAKE_GNUtoMS=ON
|
||||
${CMAKE_COMMAND_LINE}
|
||||
"@source_dir@")
|
|
@ -0,0 +1,31 @@
|
|||
This file provides a few notes to CMake developers about how to add
|
||||
support for a new language to CMake. It is also possible to place
|
||||
these files in :variable:`CMAKE_MODULE_PATH` within an outside project
|
||||
to add languages not supported by upstream CMake. However, this is not
|
||||
a fully supported use case.
|
||||
|
||||
The implementation behind the scenes of project/enable_language,
|
||||
including the compiler/platform modules, is an *internal* API that
|
||||
does not make any compatibility guarantees. It is not covered in the
|
||||
official reference documentation that is versioned with the source code.
|
||||
Maintainers of external language support are responsible for porting
|
||||
it to each version of CMake as upstream changes are made. Since
|
||||
the API is internal we will not necessarily include notice of any
|
||||
changes in release notes.
|
||||
|
||||
|
||||
CMakeDetermine(LANG)Compiler.cmake -> this should find the compiler for LANG and configure CMake(LANG)Compiler.cmake.in
|
||||
|
||||
CMake(LANG)Compiler.cmake.in -> used by CMakeDetermine(LANG)Compiler.cmake
|
||||
This file is used to store compiler information and is copied down into try
|
||||
compile directories so that try compiles do not need to re-determine and test the LANG
|
||||
|
||||
CMakeTest(LANG)Compiler.cmake -> test the compiler and set:
|
||||
SET(CMAKE_(LANG)_COMPILER_WORKS 1 CACHE INTERNAL "")
|
||||
|
||||
CMake(LANG)Information.cmake -> set up rule variables for LANG :
|
||||
CMAKE_(LANG)_CREATE_SHARED_LIBRARY
|
||||
CMAKE_(LANG)_CREATE_SHARED_MODULE
|
||||
CMAKE_(LANG)_CREATE_STATIC_LIBRARY
|
||||
CMAKE_(LANG)_COMPILE_OBJECT
|
||||
CMAKE_(LANG)_LINK_EXECUTABLE
|
|
@ -0,0 +1,76 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
|
||||
# Old CMake versions did not support OS X universal binaries anyway,
|
||||
# so just get through this with at least some size for the types.
|
||||
list(LENGTH CMAKE_OSX_ARCHITECTURES NUM_ARCHS)
|
||||
if(${NUM_ARCHS} GREATER 1)
|
||||
if(NOT DEFINED CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
|
||||
message(WARNING "This module does not work with OS X universal binaries.")
|
||||
set(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES 1)
|
||||
list(GET CMAKE_OSX_ARCHITECTURES 0 CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include (CheckTypeSize)
|
||||
CHECK_TYPE_SIZE(int CMAKE_SIZEOF_INT)
|
||||
CHECK_TYPE_SIZE(long CMAKE_SIZEOF_LONG)
|
||||
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
|
||||
CHECK_TYPE_SIZE(char CMAKE_SIZEOF_CHAR)
|
||||
CHECK_TYPE_SIZE(short CMAKE_SIZEOF_SHORT)
|
||||
CHECK_TYPE_SIZE(float CMAKE_SIZEOF_FLOAT)
|
||||
CHECK_TYPE_SIZE(double CMAKE_SIZEOF_DOUBLE)
|
||||
|
||||
include (CheckIncludeFile)
|
||||
CHECK_INCLUDE_FILE("limits.h" CMAKE_HAVE_LIMITS_H)
|
||||
CHECK_INCLUDE_FILE("unistd.h" CMAKE_HAVE_UNISTD_H)
|
||||
CHECK_INCLUDE_FILE("pthread.h" CMAKE_HAVE_PTHREAD_H)
|
||||
|
||||
include (CheckIncludeFiles)
|
||||
CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SYS_PRCTL_H)
|
||||
|
||||
include (TestBigEndian)
|
||||
TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
|
||||
include (FindX11)
|
||||
|
||||
if("${X11_X11_INCLUDE_PATH}" STREQUAL "/usr/include")
|
||||
set (CMAKE_X_CFLAGS "" CACHE STRING "X11 extra flags.")
|
||||
else()
|
||||
set (CMAKE_X_CFLAGS "-I${X11_X11_INCLUDE_PATH}" CACHE STRING
|
||||
"X11 extra flags.")
|
||||
endif()
|
||||
set (CMAKE_X_LIBS "${X11_LIBRARIES}" CACHE STRING
|
||||
"Libraries and options used in X11 programs.")
|
||||
set (CMAKE_HAS_X "${X11_FOUND}" CACHE INTERNAL "Is X11 around.")
|
||||
|
||||
include (FindThreads)
|
||||
|
||||
set (CMAKE_THREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING
|
||||
"Thread library used.")
|
||||
|
||||
set (CMAKE_USE_PTHREADS "${CMAKE_USE_PTHREADS_INIT}" CACHE BOOL
|
||||
"Use the pthreads library.")
|
||||
|
||||
set (CMAKE_USE_WIN32_THREADS "${CMAKE_USE_WIN32_THREADS_INIT}" CACHE BOOL
|
||||
"Use the win32 thread library.")
|
||||
|
||||
set (CMAKE_HP_PTHREADS ${CMAKE_HP_PTHREADS_INIT} CACHE BOOL
|
||||
"Use HP pthreads.")
|
||||
|
||||
if(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
|
||||
set(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
|
||||
set(__ERASE_CMAKE_TRY_COMPILE_OSX_ARCHITECTURES)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
CMAKE_HP_PTHREADS
|
||||
CMAKE_THREAD_LIBS
|
||||
CMAKE_USE_PTHREADS
|
||||
CMAKE_USE_WIN32_THREADS
|
||||
CMAKE_X_CFLAGS
|
||||
CMAKE_X_LIBS
|
||||
)
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
CMakeBackwardCompatibilityCXX
|
||||
-----------------------------
|
||||
|
||||
define a bunch of backwards compatibility variables
|
||||
|
||||
::
|
||||
|
||||
CMAKE_ANSI_CXXFLAGS - flag for ansi c++
|
||||
CMAKE_HAS_ANSI_STRING_STREAM - has <strstream>
|
||||
include(TestForANSIStreamHeaders)
|
||||
include(CheckIncludeFileCXX)
|
||||
include(TestForSTDNamespace)
|
||||
include(TestForANSIForScope)
|
||||
#]=======================================================================]
|
||||
|
||||
if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
|
||||
# check for some ANSI flags in the CXX compiler if it is not gnu
|
||||
if(NOT CMAKE_COMPILER_IS_GNUCXX)
|
||||
include(TestCXXAcceptsFlag)
|
||||
set(CMAKE_TRY_ANSI_CXX_FLAGS "")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "OSF")
|
||||
set(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname")
|
||||
endif()
|
||||
# if CMAKE_TRY_ANSI_CXX_FLAGS has something in it, see
|
||||
# if the compiler accepts it
|
||||
if(NOT CMAKE_TRY_ANSI_CXX_FLAGS STREQUAL "")
|
||||
CHECK_CXX_ACCEPTS_FLAG(${CMAKE_TRY_ANSI_CXX_FLAGS} CMAKE_CXX_ACCEPTS_FLAGS)
|
||||
# if the compiler liked the flag then set CMAKE_ANSI_CXXFLAGS
|
||||
# to the flag
|
||||
if(CMAKE_CXX_ACCEPTS_FLAGS)
|
||||
set(CMAKE_ANSI_CXXFLAGS ${CMAKE_TRY_ANSI_CXX_FLAGS} CACHE INTERNAL
|
||||
"What flags are required by the c++ compiler to make it ansi." )
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
|
||||
string(APPEND CMAKE_CXX_FLAGS " ${CMAKE_ANSI_CXXFLAGS}")
|
||||
include(TestForANSIStreamHeaders)
|
||||
include(CheckIncludeFileCXX)
|
||||
include(TestForSTDNamespace)
|
||||
include(TestForANSIForScope)
|
||||
include(TestForSSTREAM)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_SAVE}")
|
||||
endif()
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
set (CMAKE_MAKE_PROGRAM "make" CACHE STRING
|
||||
"Program used to build from makefiles.")
|
||||
mark_as_advanced(CMAKE_MAKE_PROGRAM)
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
# The command CMAKE_EXPORT_BUILD_SETTINGS(...) was used by
|
||||
# @PROJECT_NAME@ to generate this file. As of CMake 2.8 the
|
||||
# functionality of this command has been dropped as it was deemed
|
||||
# harmful (confusing users by changing their compiler).
|
||||
|
||||
# CMake 2.6 and below do not support loading their equivalent of this
|
||||
# file if it was produced by a newer version of CMake. CMake 2.8 and
|
||||
# above simply do not load this file. Therefore we simply error out.
|
||||
message(FATAL_ERROR
|
||||
"This @PROJECT_NAME@ was built by CMake @CMAKE_VERSION@, but this is CMake "
|
||||
"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}. "
|
||||
"Please upgrade CMake to a more recent version.")
|
|
@ -0,0 +1,77 @@
|
|||
set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
|
||||
set(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@")
|
||||
set(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@")
|
||||
set(CMAKE_C_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@")
|
||||
set(CMAKE_C_COMPILER_VERSION_INTERNAL "@CMAKE_C_COMPILER_VERSION_INTERNAL@")
|
||||
set(CMAKE_C_COMPILER_WRAPPER "@CMAKE_C_COMPILER_WRAPPER@")
|
||||
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "@CMAKE_C_STANDARD_COMPUTED_DEFAULT@")
|
||||
set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@")
|
||||
set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@")
|
||||
set(CMAKE_C99_COMPILE_FEATURES "@CMAKE_C99_COMPILE_FEATURES@")
|
||||
set(CMAKE_C11_COMPILE_FEATURES "@CMAKE_C11_COMPILE_FEATURES@")
|
||||
|
||||
set(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@")
|
||||
set(CMAKE_C_SIMULATE_ID "@CMAKE_C_SIMULATE_ID@")
|
||||
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "@CMAKE_C_COMPILER_FRONTEND_VARIANT@")
|
||||
set(CMAKE_C_SIMULATE_VERSION "@CMAKE_C_SIMULATE_VERSION@")
|
||||
@_SET_CMAKE_C_COMPILER_ARCHITECTURE_ID@
|
||||
@_SET_CMAKE_C_COMPILER_SYSROOT@
|
||||
@SET_MSVC_C_ARCHITECTURE_ID@
|
||||
@SET_CMAKE_XCODE_ARCHS@
|
||||
set(CMAKE_AR "@CMAKE_AR@")
|
||||
set(CMAKE_C_COMPILER_AR "@CMAKE_C_COMPILER_AR@")
|
||||
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
|
||||
set(CMAKE_C_COMPILER_RANLIB "@CMAKE_C_COMPILER_RANLIB@")
|
||||
set(CMAKE_LINKER "@CMAKE_LINKER@")
|
||||
set(CMAKE_MT "@CMAKE_MT@")
|
||||
set(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@)
|
||||
set(CMAKE_C_COMPILER_LOADED 1)
|
||||
set(CMAKE_C_COMPILER_WORKS @CMAKE_C_COMPILER_WORKS@)
|
||||
set(CMAKE_C_ABI_COMPILED @CMAKE_C_ABI_COMPILED@)
|
||||
set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@)
|
||||
set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@)
|
||||
if(CMAKE_COMPILER_IS_CYGWIN)
|
||||
set(CYGWIN 1)
|
||||
set(UNIX 1)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_COMPILER_ENV_VAR "CC")
|
||||
|
||||
if(CMAKE_COMPILER_IS_MINGW)
|
||||
set(MINGW 1)
|
||||
endif()
|
||||
set(CMAKE_C_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
|
||||
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||
set(CMAKE_C_LINKER_PREFERENCE 10)
|
||||
|
||||
# Save compiler ABI information.
|
||||
set(CMAKE_C_SIZEOF_DATA_PTR "@CMAKE_C_SIZEOF_DATA_PTR@")
|
||||
set(CMAKE_C_COMPILER_ABI "@CMAKE_C_COMPILER_ABI@")
|
||||
set(CMAKE_C_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@")
|
||||
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR)
|
||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ABI)
|
||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "@CMAKE_C_CL_SHOWINCLUDES_PREFIX@")
|
||||
if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
|
||||
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
|
||||
endif()
|
||||
|
||||
@CMAKE_C_COMPILER_CUSTOM_CODE@
|
||||
@CMAKE_C_SYSROOT_FLAG_CODE@
|
||||
@CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
|
||||
|
||||
set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES@")
|
||||
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@")
|
||||
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_DIRECTORIES@")
|
||||
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
|
|
@ -0,0 +1,25 @@
|
|||
#ifdef __cplusplus
|
||||
# error "A C++ compiler has been selected for C."
|
||||
#endif
|
||||
|
||||
#ifdef __CLASSIC_C__
|
||||
# define const
|
||||
#endif
|
||||
|
||||
#include "CMakeCompilerABI.h"
|
||||
|
||||
#ifdef __CLASSIC_C__
|
||||
int main(argc, argv) int argc;
|
||||
char* argv[];
|
||||
#else
|
||||
int main(int argc, char* argv[])
|
||||
#endif
|
||||
{
|
||||
int require = 0;
|
||||
require += info_sizeof_dptr[argc];
|
||||
#if defined(ABI_ID)
|
||||
require += info_abi[argc];
|
||||
#endif
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
#ifdef __cplusplus
|
||||
# error "A C++ compiler has been selected for C."
|
||||
#endif
|
||||
|
||||
#if defined(__18CXX)
|
||||
# define ID_VOID_MAIN
|
||||
#endif
|
||||
#if defined(__CLASSIC_C__)
|
||||
/* cv-qualifiers did not exist in K&R C */
|
||||
# define const
|
||||
# define volatile
|
||||
#endif
|
||||
|
||||
@CMAKE_C_COMPILER_ID_CONTENT@
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
||||
#ifdef SIMULATE_ID
|
||||
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
|
||||
#endif
|
||||
|
||||
#ifdef __QNXNTO__
|
||||
char const* qnxnto = "INFO" ":" "qnxnto[]";
|
||||
#endif
|
||||
|
||||
#if defined(__CRAYXE) || defined(__CRAYXC)
|
||||
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
|
||||
#endif
|
||||
|
||||
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
|
||||
@CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@
|
||||
|
||||
#if !defined(__STDC__)
|
||||
# if (defined(_MSC_VER) && !defined(__clang__)) \
|
||||
|| (defined(__ibmxl__) || defined(__IBMC__))
|
||||
# define C_DIALECT "90"
|
||||
# else
|
||||
# define C_DIALECT
|
||||
# endif
|
||||
#elif __STDC_VERSION__ >= 201000L
|
||||
# define C_DIALECT "11"
|
||||
#elif __STDC_VERSION__ >= 199901L
|
||||
# define C_DIALECT "99"
|
||||
#else
|
||||
# define C_DIALECT "90"
|
||||
#endif
|
||||
const char* info_language_dialect_default =
|
||||
"INFO" ":" "dialect_default[" C_DIALECT "]";
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef ID_VOID_MAIN
|
||||
void main() {}
|
||||
#else
|
||||
# if defined(__CLASSIC_C__)
|
||||
int main(argc, argv) int argc; char *argv[];
|
||||
# else
|
||||
int main(int argc, char* argv[])
|
||||
# endif
|
||||
{
|
||||
int require = 0;
|
||||
require += info_compiler[argc];
|
||||
require += info_platform[argc];
|
||||
require += info_arch[argc];
|
||||
#ifdef COMPILER_VERSION_MAJOR
|
||||
require += info_version[argc];
|
||||
#endif
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
require += info_version_internal[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_ID
|
||||
require += info_simulate[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
require += info_simulate_version[argc];
|
||||
#endif
|
||||
#if defined(__CRAYXE) || defined(__CRAYXC)
|
||||
require += info_cray[argc];
|
||||
#endif
|
||||
require += info_language_dialect_default[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,195 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This file sets the basic flags for the C language in CMake.
|
||||
# It also loads the available platform file for the system-compiler
|
||||
# if it exists.
|
||||
# It also loads a system - compiler - processor (or target hardware)
|
||||
# specific file, which is mainly useful for crosscompiling and embedded systems.
|
||||
|
||||
include(CMakeLanguageInformation)
|
||||
|
||||
# some compilers use different extensions (e.g. sdcc uses .rel)
|
||||
# so set the extension here first so it can be overridden by the compiler specific file
|
||||
if(UNIX)
|
||||
set(CMAKE_C_OUTPUT_EXTENSION .o)
|
||||
else()
|
||||
set(CMAKE_C_OUTPUT_EXTENSION .obj)
|
||||
endif()
|
||||
|
||||
set(_INCLUDED_FILE 0)
|
||||
|
||||
# Load compiler-specific information.
|
||||
if(CMAKE_C_COMPILER_ID)
|
||||
include(Compiler/${CMAKE_C_COMPILER_ID}-C OPTIONAL)
|
||||
endif()
|
||||
|
||||
set(CMAKE_BASE_NAME)
|
||||
get_filename_component(CMAKE_BASE_NAME "${CMAKE_C_COMPILER}" NAME_WE)
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(CMAKE_BASE_NAME gcc)
|
||||
endif()
|
||||
|
||||
|
||||
# load a hardware specific file, mostly useful for embedded compilers
|
||||
if(CMAKE_SYSTEM_PROCESSOR)
|
||||
if(CMAKE_C_COMPILER_ID)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-C-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif()
|
||||
if (NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
|
||||
# load the system- and compiler specific files
|
||||
if(CMAKE_C_COMPILER_ID)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-C
|
||||
OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif()
|
||||
if (NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_BASE_NAME}
|
||||
OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif ()
|
||||
|
||||
# load any compiler-wrapper specific information
|
||||
if (CMAKE_C_COMPILER_WRAPPER)
|
||||
__cmake_include_compiler_wrapper(C)
|
||||
endif ()
|
||||
|
||||
# We specify the compiler information in the system file for some
|
||||
# platforms, but this language may not have been enabled when the file
|
||||
# was first included. Include it again to get the language info.
|
||||
# Remove this when all compiler info is removed from system files.
|
||||
if (NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
|
||||
endif ()
|
||||
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR)
|
||||
foreach(f ${CMAKE_C_ABI_FILES})
|
||||
include(${f})
|
||||
endforeach()
|
||||
unset(CMAKE_C_ABI_FILES)
|
||||
endif()
|
||||
|
||||
# This should be included before the _INIT variables are
|
||||
# used to initialize the cache. Since the rule variables
|
||||
# have if blocks on them, users can still define them here.
|
||||
# But, it should still be after the platform file so changes can
|
||||
# be made to those values.
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE)
|
||||
# Save the full path of the file so try_compile can use it.
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE_C)
|
||||
# Save the full path of the file so try_compile can use it.
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE_C} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE_C "${_override}")
|
||||
endif()
|
||||
|
||||
|
||||
# for most systems a module is the same as a shared library
|
||||
# so unless the variable CMAKE_MODULE_EXISTS is set just
|
||||
# copy the values from the LIBRARY variables
|
||||
if(NOT CMAKE_MODULE_EXISTS)
|
||||
set(CMAKE_SHARED_MODULE_C_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
|
||||
set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS_INIT "$ENV{CFLAGS} ${CMAKE_C_FLAGS_INIT}")
|
||||
|
||||
cmake_initialize_per_config_variable(CMAKE_C_FLAGS "Flags used by the C compiler")
|
||||
|
||||
if(CMAKE_C_STANDARD_LIBRARIES_INIT)
|
||||
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES_INIT}"
|
||||
CACHE STRING "Libraries linked by default with all C applications.")
|
||||
mark_as_advanced(CMAKE_C_STANDARD_LIBRARIES)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_C_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_C_COMPILER_LAUNCHER})
|
||||
set(CMAKE_C_COMPILER_LAUNCHER "$ENV{CMAKE_C_COMPILER_LAUNCHER}"
|
||||
CACHE STRING "Compiler launcher for C.")
|
||||
endif()
|
||||
|
||||
include(CMakeCommonLanguageInclude)
|
||||
|
||||
# now define the following rule variables
|
||||
|
||||
# CMAKE_C_CREATE_SHARED_LIBRARY
|
||||
# CMAKE_C_CREATE_SHARED_MODULE
|
||||
# CMAKE_C_COMPILE_OBJECT
|
||||
# CMAKE_C_LINK_EXECUTABLE
|
||||
|
||||
# variables supplied by the generator at use time
|
||||
# <TARGET>
|
||||
# <TARGET_BASE> the target without the suffix
|
||||
# <OBJECTS>
|
||||
# <OBJECT>
|
||||
# <LINK_LIBRARIES>
|
||||
# <FLAGS>
|
||||
# <LINK_FLAGS>
|
||||
|
||||
# C compiler information
|
||||
# <CMAKE_C_COMPILER>
|
||||
# <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS>
|
||||
# <CMAKE_SHARED_MODULE_CREATE_C_FLAGS>
|
||||
# <CMAKE_C_LINK_FLAGS>
|
||||
|
||||
# Static library tools
|
||||
# <CMAKE_AR>
|
||||
# <CMAKE_RANLIB>
|
||||
|
||||
|
||||
# create a C shared library
|
||||
if(NOT CMAKE_C_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_C_CREATE_SHARED_LIBRARY
|
||||
"<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
# create a C shared module just copy the shared library rule
|
||||
if(NOT CMAKE_C_CREATE_SHARED_MODULE)
|
||||
set(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_LIBRARY})
|
||||
endif()
|
||||
|
||||
# Create a static archive incrementally for large object file counts.
|
||||
# If CMAKE_C_CREATE_STATIC_LIBRARY is set it will override these.
|
||||
if(NOT DEFINED CMAKE_C_ARCHIVE_CREATE)
|
||||
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_C_ARCHIVE_APPEND)
|
||||
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_C_ARCHIVE_FINISH)
|
||||
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
|
||||
endif()
|
||||
|
||||
# compile a C file into an object file
|
||||
if(NOT CMAKE_C_COMPILE_OBJECT)
|
||||
set(CMAKE_C_COMPILE_OBJECT
|
||||
"<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_C_LINK_EXECUTABLE)
|
||||
set(CMAKE_C_LINK_EXECUTABLE
|
||||
"<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_C_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_C_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_C_FLAG_SEP)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_C_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RPATH_LINK_C_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RPATH_LINK_C_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG})
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_INFORMATION_LOADED 1)
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
set(CMAKE_CSharp_COMPILER "@CMAKE_CSharp_COMPILER@")
|
||||
set(CMAKE_CSharp_COMPILER_ID "@CMAKE_CSharp_COMPILER_ID@")
|
||||
set(CMAKE_CSharp_COMPILER_VERSION "@CMAKE_CSharp_COMPILER_VERSION@")
|
||||
|
||||
set(CMAKE_CSharp_COMPILER_LOADED 1)
|
||||
set(CMAKE_CSharp_COMPILER_WORKS "@CMAKE_CSharp_COMPILER_WORKS@")
|
||||
|
||||
set(CMAKE_CSharp_COMPILER_ID_RUN "@CMAKE_CSharp_COMPILER_ID_RUN@")
|
||||
set(CMAKE_CSharp_IGNORE_EXTENSIONS "inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC")
|
||||
set(CMAKE_CSharp_SOURCE_FILE_EXTENSIONS "cs")
|
|
@ -0,0 +1,63 @@
|
|||
using System;
|
||||
|
||||
namespace CSharp
|
||||
{
|
||||
public class CSharpApp
|
||||
{
|
||||
const string InfoCompiler = "INFO:compiler[Microsoft "
|
||||
#if PlatformToolsetv100
|
||||
+ "Visual Studio"
|
||||
#elif PlatformToolsetv110
|
||||
+ "Visual Studio"
|
||||
#elif PlatformToolsetv120
|
||||
+ "Visual Studio"
|
||||
#elif PlatformToolsetv140
|
||||
+ "Visual Studio"
|
||||
#elif PlatformToolsetv141
|
||||
+ "Visual Studio"
|
||||
#else
|
||||
+ "unknown"
|
||||
#endif
|
||||
+ "]";
|
||||
|
||||
const string InfoPlatform = "INFO:platform[Windows]";
|
||||
|
||||
const string InfoArchitecture = "INFO:arch["
|
||||
#if Platformx64
|
||||
+ "x64"
|
||||
#elif Platformx86
|
||||
+ "x86"
|
||||
#elif PlatformxWin32
|
||||
+ "Win32]"
|
||||
#else
|
||||
+ "unknown"
|
||||
#endif
|
||||
+ "]";
|
||||
|
||||
const string InfoCompilerVersion = "INFO:compiler_version["
|
||||
#if PlatformToolsetv100
|
||||
+ "2010"
|
||||
#elif PlatformToolsetv110
|
||||
+ "2012"
|
||||
#elif PlatformToolsetv120
|
||||
+ "2013"
|
||||
#elif PlatformToolsetv140
|
||||
+ "2015"
|
||||
#elif PlatformToolsetv141
|
||||
+ "2017"
|
||||
#else
|
||||
+ "9999"
|
||||
#endif
|
||||
+ "]";
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// we have to print the lines to make sure
|
||||
// the compiler does not optimize them away ...
|
||||
System.Console.WriteLine(InfoCompiler);
|
||||
System.Console.WriteLine(InfoPlatform);
|
||||
System.Console.WriteLine(InfoArchitecture);
|
||||
System.Console.WriteLine(InfoCompilerVersion);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
# This file sets the basic flags for the C# language in CMake.
|
||||
# It also loads the available platform file for the system-compiler
|
||||
# if it exists.
|
||||
|
||||
set(CMAKE_BASE_NAME)
|
||||
get_filename_component(CMAKE_BASE_NAME "${CMAKE_CSharp_COMPILER}" NAME_WE)
|
||||
|
||||
set(CMAKE_BUILD_TYPE_INIT Debug)
|
||||
|
||||
set(CMAKE_CSharp_FLAGS_INIT "/define:TRACE")
|
||||
set(CMAKE_CSharp_FLAGS_DEBUG_INIT "/debug:full /optimize- /warn:3 /errorreport:prompt /define:DEBUG")
|
||||
set(CMAKE_CSharp_FLAGS_RELEASE_INIT "/debug:none /optimize /warn:1 /errorreport:queue")
|
||||
set(CMAKE_CSharp_FLAGS_RELWITHDEBINFO_INIT "/debug:full /optimize-")
|
||||
set(CMAKE_CSharp_FLAGS_MINSIZEREL_INIT "/debug:none /optimize")
|
||||
set(CMAKE_CSharp_LINKER_SUPPORTS_PDB ON)
|
||||
|
||||
set(CMAKE_CSharp_STANDARD_LIBRARIES_INIT "System")
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(CMAKE_CSharp_FLAGS_INIT "/platform:x86 ${CMAKE_CSharp_FLAGS_INIT}")
|
||||
else()
|
||||
set(CMAKE_CSharp_FLAGS_INIT "/platform:x64 ${CMAKE_CSharp_FLAGS_INIT}")
|
||||
endif()
|
||||
|
||||
# This should be included before the _INIT variables are
|
||||
# used to initialize the cache. Since the rule variables
|
||||
# have if blocks on them, users can still define them here.
|
||||
# But, it should still be after the platform file so changes can
|
||||
# be made to those values.
|
||||
|
||||
# for most systems a module is the same as a shared library
|
||||
# so unless the variable CMAKE_MODULE_EXISTS is set just
|
||||
# copy the values from the LIBRARY variables
|
||||
if(NOT CMAKE_MODULE_EXISTS)
|
||||
set(CMAKE_SHARED_MODULE_CSharp_FLAGS ${CMAKE_SHARED_LIBRARY_CSharp_FLAGS})
|
||||
set(CMAKE_SHARED_MODULE_CREATE_CSharp_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CSharp_FLAGS})
|
||||
endif()
|
||||
|
||||
# add the flags to the cache based
|
||||
# on the initial values computed in the platform/*.cmake files
|
||||
# use _INIT variables so that this only happens the first time
|
||||
# and you can set these flags in the cmake cache
|
||||
set(CMAKE_CSharp_FLAGS_INIT "$ENV{CSFLAGS} ${CMAKE_CSharp_FLAGS_INIT}")
|
||||
|
||||
cmake_initialize_per_config_variable(CMAKE_CSharp_FLAGS "Flags used by the C# compiler")
|
||||
|
||||
if(CMAKE_CSharp_STANDARD_LIBRARIES_INIT)
|
||||
set(CMAKE_CSharp_STANDARD_LIBRARIES "${CMAKE_CSharp_STANDARD_LIBRARIES_INIT}"
|
||||
CACHE STRING "Libraries linked by default with all C# applications.")
|
||||
mark_as_advanced(CMAKE_CSharp_STANDARD_LIBRARIES)
|
||||
endif()
|
||||
|
||||
# set missing flags (if they are not defined). This is needed in the
|
||||
# unlikely case that you have only C# and no C/C++ targets in your
|
||||
# project.
|
||||
cmake_initialize_per_config_variable(CMAKE_EXE_LINKER_FLAGS "Flags used by the linker")
|
||||
cmake_initialize_per_config_variable(CMAKE_SHARED_LINKER_FLAGS "Flags used by the linker during the creation of shared libraries")
|
||||
|
||||
set(CMAKE_CSharp_CREATE_SHARED_LIBRARY "CSharp_NO_CREATE_SHARED_LIBRARY")
|
||||
set(CMAKE_CSharp_CREATE_SHARED_MODULE "CSharp_NO_CREATE_SHARED_MODULE")
|
||||
set(CMAKE_CSharp_LINK_EXECUTABLE "CSharp_NO_LINK_EXECUTABLE")
|
||||
|
||||
set(CMAKE_CSharp_USE_RESPONSE_FILE_FOR_OBJECTS 1)
|
||||
set(CMAKE_CSharp_INFORMATION_LOADED 1)
|
|
@ -0,0 +1,64 @@
|
|||
set(CMAKE_CUDA_COMPILER "@CMAKE_CUDA_COMPILER@")
|
||||
set(CMAKE_CUDA_HOST_COMPILER "@CMAKE_CUDA_HOST_COMPILER@")
|
||||
set(CMAKE_CUDA_HOST_LINK_LAUNCHER "@CMAKE_CUDA_HOST_LINK_LAUNCHER@")
|
||||
set(CMAKE_CUDA_COMPILER_ID "@CMAKE_CUDA_COMPILER_ID@")
|
||||
set(CMAKE_CUDA_COMPILER_VERSION "@CMAKE_CUDA_COMPILER_VERSION@")
|
||||
set(CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT "@CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT@")
|
||||
set(CMAKE_CUDA_COMPILE_FEATURES "@CMAKE_CUDA_COMPILE_FEATURES@")
|
||||
set(CMAKE_CUDA03_COMPILE_FEATURES "@CMAKE_CUDA03_COMPILE_FEATURES@")
|
||||
set(CMAKE_CUDA11_COMPILE_FEATURES "@CMAKE_CUDA11_COMPILE_FEATURES@")
|
||||
set(CMAKE_CUDA14_COMPILE_FEATURES "@CMAKE_CUDA14_COMPILE_FEATURES@")
|
||||
set(CMAKE_CUDA17_COMPILE_FEATURES "@CMAKE_CUDA17_COMPILE_FEATURES@")
|
||||
set(CMAKE_CUDA20_COMPILE_FEATURES "@CMAKE_CUDA20_COMPILE_FEATURES@")
|
||||
|
||||
set(CMAKE_CUDA_PLATFORM_ID "@CMAKE_CUDA_PLATFORM_ID@")
|
||||
set(CMAKE_CUDA_SIMULATE_ID "@CMAKE_CUDA_SIMULATE_ID@")
|
||||
set(CMAKE_CUDA_COMPILER_FRONTEND_VARIANT "@CMAKE_CUDA_COMPILER_FRONTEND_VARIANT@")
|
||||
set(CMAKE_CUDA_SIMULATE_VERSION "@CMAKE_CUDA_SIMULATE_VERSION@")
|
||||
@SET_MSVC_CUDA_ARCHITECTURE_ID@
|
||||
@_SET_CMAKE_CUDA_COMPILER_SYSROOT@
|
||||
|
||||
set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX")
|
||||
set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX")
|
||||
|
||||
set(CMAKE_CUDA_COMPILER_LOADED 1)
|
||||
set(CMAKE_CUDA_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_CUDA_SOURCE_FILE_EXTENSIONS cu)
|
||||
set(CMAKE_CUDA_LINKER_PREFERENCE 15)
|
||||
set(CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES 1)
|
||||
|
||||
set(CMAKE_CUDA_SIZEOF_DATA_PTR "@CMAKE_CUDA_SIZEOF_DATA_PTR@")
|
||||
set(CMAKE_CUDA_COMPILER_ABI "@CMAKE_CUDA_COMPILER_ABI@")
|
||||
set(CMAKE_CUDA_LIBRARY_ARCHITECTURE "@CMAKE_CUDA_LIBRARY_ARCHITECTURE@")
|
||||
|
||||
if(CMAKE_CUDA_SIZEOF_DATA_PTR)
|
||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_CUDA_SIZEOF_DATA_PTR}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CUDA_COMPILER_ABI)
|
||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CUDA_COMPILER_ABI}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CUDA_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_CUDA_LIBRARY_ARCHITECTURE@")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "@CMAKE_CUDA_COMPILER_TOOLKIT_ROOT@")
|
||||
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "@CMAKE_CUDA_COMPILER_LIBRARY_ROOT@")
|
||||
|
||||
set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "@CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES@")
|
||||
|
||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES@")
|
||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES@")
|
||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
|
||||
|
||||
set(CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES@")
|
||||
set(CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES@")
|
||||
set(CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES@")
|
||||
set(CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
|
||||
|
||||
@_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT@
|
||||
|
||||
set(CMAKE_LINKER "@CMAKE_LINKER@")
|
||||
set(CMAKE_AR "@CMAKE_AR@")
|
||||
set(CMAKE_MT "@CMAKE_MT@")
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef __CUDACC__
|
||||
# error "A C or C++ compiler has been selected for CUDA"
|
||||
#endif
|
||||
|
||||
#include "CMakeCompilerABI.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int require = 0;
|
||||
require += info_sizeof_dptr[argc];
|
||||
#if defined(ABI_ID)
|
||||
require += info_abi[argc];
|
||||
#endif
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
#ifndef __CUDACC__
|
||||
# error "A C or C++ compiler has been selected for CUDA"
|
||||
#endif
|
||||
|
||||
@CMAKE_CUDA_COMPILER_ID_CONTENT@
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
||||
#ifdef SIMULATE_ID
|
||||
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
|
||||
#endif
|
||||
|
||||
@CMAKE_CUDA_COMPILER_ID_PLATFORM_CONTENT@
|
||||
@CMAKE_CUDA_COMPILER_ID_ERROR_FOR_TEST@
|
||||
|
||||
const char* info_language_dialect_default = "INFO" ":" "dialect_default["
|
||||
#if __cplusplus > 201703L
|
||||
"20"
|
||||
#elif __cplusplus >= 201703L
|
||||
"17"
|
||||
#elif __cplusplus >= 201402L
|
||||
"14"
|
||||
#elif __cplusplus >= 201103L
|
||||
"11"
|
||||
#else
|
||||
"03"
|
||||
#endif
|
||||
"]";
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int require = 0;
|
||||
require += info_compiler[argc];
|
||||
require += info_platform[argc];
|
||||
#ifdef COMPILER_VERSION_MAJOR
|
||||
require += info_version[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_ID
|
||||
require += info_simulate[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
require += info_simulate_version[argc];
|
||||
#endif
|
||||
require += info_language_dialect_default[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
|
@ -0,0 +1,205 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
if(UNIX)
|
||||
set(CMAKE_CUDA_OUTPUT_EXTENSION .o)
|
||||
else()
|
||||
set(CMAKE_CUDA_OUTPUT_EXTENSION .obj)
|
||||
endif()
|
||||
set(CMAKE_INCLUDE_FLAG_CUDA "-I")
|
||||
|
||||
# Set implicit links early so compiler-specific modules can use them.
|
||||
set(__IMPLICT_LINKS )
|
||||
foreach(dir ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES})
|
||||
string(APPEND __IMPLICT_LINKS " -L\"${dir}\"")
|
||||
endforeach()
|
||||
foreach(lib ${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES})
|
||||
if(${lib} MATCHES "/")
|
||||
string(APPEND __IMPLICT_LINKS " \"${lib}\"")
|
||||
else()
|
||||
string(APPEND __IMPLICT_LINKS " -l${lib}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Load compiler-specific information.
|
||||
if(CMAKE_CUDA_COMPILER_ID)
|
||||
include(Compiler/${CMAKE_CUDA_COMPILER_ID}-CUDA OPTIONAL)
|
||||
endif()
|
||||
|
||||
# load the system- and compiler specific files
|
||||
if(CMAKE_CUDA_COMPILER_ID)
|
||||
# load a hardware specific file, mostly useful for embedded compilers
|
||||
if(CMAKE_SYSTEM_PROCESSOR)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_CUDA_COMPILER_ID}-CUDA-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
|
||||
endif()
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_CUDA_COMPILER_ID}-CUDA OPTIONAL)
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG)
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG_SEP)
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CUDA_FLAG)
|
||||
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_EXE_EXPORTS_CUDA_FLAG)
|
||||
set(CMAKE_EXE_EXPORTS_CUDA_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_CUDA_FLAG)
|
||||
set(CMAKE_SHARED_LIBRARY_SONAME_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_CUDA_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_CUDA_FLAG_SEP)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_CUDA_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_CUDA_FLAG_SEP})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RPATH_LINK_CUDA_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RPATH_LINK_CUDA_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_CUDA_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CUDA_WITH_RUNTIME_PATH)
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_CUDA_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH})
|
||||
endif()
|
||||
|
||||
|
||||
# for most systems a module is the same as a shared library
|
||||
# so unless the variable CMAKE_MODULE_EXISTS is set just
|
||||
# copy the values from the LIBRARY variables
|
||||
if(NOT CMAKE_MODULE_EXISTS)
|
||||
set(CMAKE_SHARED_MODULE_CUDA_FLAGS ${CMAKE_SHARED_LIBRARY_CUDA_FLAGS})
|
||||
set(CMAKE_SHARED_MODULE_CREATE_CUDA_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS})
|
||||
endif()
|
||||
|
||||
# add the flags to the cache based
|
||||
# on the initial values computed in the platform/*.cmake files
|
||||
# use _INIT variables so that this only happens the first time
|
||||
# and you can set these flags in the cmake cache
|
||||
set(CMAKE_CUDA_FLAGS_INIT "$ENV{CUDAFLAGS} ${CMAKE_CUDA_FLAGS_INIT}")
|
||||
|
||||
cmake_initialize_per_config_variable(CMAKE_CUDA_FLAGS "Flags used by the CUDA compiler")
|
||||
|
||||
if(CMAKE_CUDA_STANDARD_LIBRARIES_INIT)
|
||||
set(CMAKE_CUDA_STANDARD_LIBRARIES "${CMAKE_CUDA_STANDARD_LIBRARIES_INIT}"
|
||||
CACHE STRING "Libraries linked by default with all CUDA applications.")
|
||||
mark_as_advanced(CMAKE_CUDA_STANDARD_LIBRARIES)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CUDA_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_CUDA_COMPILER_LAUNCHER})
|
||||
set(CMAKE_CUDA_COMPILER_LAUNCHER "$ENV{CMAKE_CUDA_COMPILER_LAUNCHER}"
|
||||
CACHE STRING "Compiler launcher for CUDA.")
|
||||
endif()
|
||||
|
||||
include(CMakeCommonLanguageInclude)
|
||||
|
||||
# now define the following rules:
|
||||
# CMAKE_CUDA_CREATE_SHARED_LIBRARY
|
||||
# CMAKE_CUDA_CREATE_SHARED_MODULE
|
||||
# CMAKE_CUDA_COMPILE_WHOLE_COMPILATION
|
||||
# CMAKE_CUDA_COMPILE_PTX_COMPILATION
|
||||
# CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION
|
||||
# CMAKE_CUDA_LINK_EXECUTABLE
|
||||
|
||||
if(CMAKE_CUDA_HOST_COMPILER AND CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
|
||||
string(APPEND _CMAKE_CUDA_EXTRA_FLAGS " -ccbin=<CMAKE_CUDA_HOST_COMPILER>")
|
||||
endif()
|
||||
|
||||
# create a shared library
|
||||
if(NOT CMAKE_CUDA_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_CUDA_CREATE_SHARED_LIBRARY
|
||||
"<CMAKE_CUDA_HOST_LINK_LAUNCHER> <CMAKE_SHARED_LIBRARY_CUDA_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
|
||||
endif()
|
||||
|
||||
# create a shared module copy the shared library rule by default
|
||||
if(NOT CMAKE_CUDA_CREATE_SHARED_MODULE)
|
||||
set(CMAKE_CUDA_CREATE_SHARED_MODULE ${CMAKE_CUDA_CREATE_SHARED_LIBRARY})
|
||||
endif()
|
||||
|
||||
# Create a static archive incrementally for large object file counts.
|
||||
if(NOT DEFINED CMAKE_CUDA_ARCHIVE_CREATE)
|
||||
set(CMAKE_CUDA_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_CUDA_ARCHIVE_APPEND)
|
||||
set(CMAKE_CUDA_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_CUDA_ARCHIVE_FINISH)
|
||||
set(CMAKE_CUDA_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
|
||||
endif()
|
||||
|
||||
#Specify how to compile when ptx has been requested
|
||||
if(NOT CMAKE_CUDA_COMPILE_PTX_COMPILATION)
|
||||
set(CMAKE_CUDA_COMPILE_PTX_COMPILATION
|
||||
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} ${_CMAKE_CUDA_PTX_FLAG} <SOURCE> -o <OBJECT>")
|
||||
endif()
|
||||
|
||||
#Specify how to compile when separable compilation has been requested
|
||||
if(NOT CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION)
|
||||
set(CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION
|
||||
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -dc <SOURCE> -o <OBJECT>")
|
||||
endif()
|
||||
|
||||
#Specify how to compile when whole compilation has been requested
|
||||
if(NOT CMAKE_CUDA_COMPILE_WHOLE_COMPILATION)
|
||||
set(CMAKE_CUDA_COMPILE_WHOLE_COMPILATION
|
||||
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -c <SOURCE> -o <OBJECT>")
|
||||
endif()
|
||||
|
||||
if(CMAKE_GENERATOR STREQUAL "Ninja" AND NOT CMAKE_DEPFILE_FLAGS_CUDA)
|
||||
set(CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION
|
||||
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <DEFINES> <INCLUDES> <FLAGS> ${_CMAKE_COMPILE_AS_CUDA_FLAG} -M <SOURCE> -MT <OBJECT> -o $DEP_FILE")
|
||||
#The Ninja generator uses the make file dependency files to determine what
|
||||
#files need to be recompiled. Unfortunately, nvcc < 10.2 doesn't support building
|
||||
#a source file and generating the dependencies of said file in a single
|
||||
#invocation. Instead we have to state that you need to chain two commands.
|
||||
#
|
||||
#The makefile generators uses the custom CMake dependency scanner, and thus
|
||||
#it is exempt from this logic.
|
||||
list(APPEND CMAKE_CUDA_COMPILE_PTX_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}")
|
||||
list(APPEND CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}")
|
||||
list(APPEND CMAKE_CUDA_COMPILE_WHOLE_COMPILATION "${CMAKE_CUDA_COMPILE_DEPENDENCY_DETECTION}")
|
||||
endif()
|
||||
|
||||
# compile a cu file into an executable
|
||||
if(NOT CMAKE_CUDA_LINK_EXECUTABLE)
|
||||
set(CMAKE_CUDA_LINK_EXECUTABLE
|
||||
"<CMAKE_CUDA_HOST_LINK_LAUNCHER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_LINKS}")
|
||||
endif()
|
||||
|
||||
# Add implicit host link directories that contain device libraries
|
||||
# to the device link line.
|
||||
set(__IMPLICT_DLINK_DIRS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
|
||||
if(__IMPLICT_DLINK_DIRS)
|
||||
list(REMOVE_ITEM __IMPLICT_DLINK_DIRS ${CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES})
|
||||
endif()
|
||||
set(__IMPLICT_DLINK_FLAGS )
|
||||
foreach(dir ${__IMPLICT_DLINK_DIRS})
|
||||
if(EXISTS "${dir}/libcurand_static.a")
|
||||
string(APPEND __IMPLICT_DLINK_FLAGS " -L\"${dir}\"")
|
||||
endif()
|
||||
endforeach()
|
||||
unset(__IMPLICT_DLINK_DIRS)
|
||||
|
||||
|
||||
#These are used when linking relocatable (dc) cuda code
|
||||
if(NOT CMAKE_CUDA_DEVICE_LINK_LIBRARY)
|
||||
set(CMAKE_CUDA_DEVICE_LINK_LIBRARY
|
||||
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_DLINK_FLAGS}")
|
||||
endif()
|
||||
if(NOT CMAKE_CUDA_DEVICE_LINK_EXECUTABLE)
|
||||
set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE
|
||||
"<CMAKE_CUDA_COMPILER> ${_CMAKE_CUDA_EXTRA_FLAGS} <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} ${_CMAKE_CUDA_EXTRA_DEVICE_LINK_FLAGS} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>${__IMPLICT_DLINK_FLAGS}")
|
||||
endif()
|
||||
|
||||
unset(__IMPLICT_DLINK_FLAGS)
|
||||
|
||||
set(CMAKE_CUDA_INFORMATION_LOADED 1)
|
|
@ -0,0 +1,89 @@
|
|||
set(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
|
||||
set(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@")
|
||||
set(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@")
|
||||
set(CMAKE_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@")
|
||||
set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "@CMAKE_CXX_COMPILER_VERSION_INTERNAL@")
|
||||
set(CMAKE_CXX_COMPILER_WRAPPER "@CMAKE_CXX_COMPILER_WRAPPER@")
|
||||
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_CXX_STANDARD_COMPUTED_DEFAULT@")
|
||||
set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@")
|
||||
set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@")
|
||||
set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@")
|
||||
set(CMAKE_CXX14_COMPILE_FEATURES "@CMAKE_CXX14_COMPILE_FEATURES@")
|
||||
set(CMAKE_CXX17_COMPILE_FEATURES "@CMAKE_CXX17_COMPILE_FEATURES@")
|
||||
set(CMAKE_CXX20_COMPILE_FEATURES "@CMAKE_CXX20_COMPILE_FEATURES@")
|
||||
|
||||
set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@")
|
||||
set(CMAKE_CXX_SIMULATE_ID "@CMAKE_CXX_SIMULATE_ID@")
|
||||
set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "@CMAKE_CXX_COMPILER_FRONTEND_VARIANT@")
|
||||
set(CMAKE_CXX_SIMULATE_VERSION "@CMAKE_CXX_SIMULATE_VERSION@")
|
||||
@_SET_CMAKE_CXX_COMPILER_ARCHITECTURE_ID@
|
||||
@_SET_CMAKE_CXX_COMPILER_SYSROOT@
|
||||
@SET_MSVC_CXX_ARCHITECTURE_ID@
|
||||
@SET_CMAKE_XCODE_ARCHS@
|
||||
set(CMAKE_AR "@CMAKE_AR@")
|
||||
set(CMAKE_CXX_COMPILER_AR "@CMAKE_CXX_COMPILER_AR@")
|
||||
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
|
||||
set(CMAKE_CXX_COMPILER_RANLIB "@CMAKE_CXX_COMPILER_RANLIB@")
|
||||
set(CMAKE_LINKER "@CMAKE_LINKER@")
|
||||
set(CMAKE_MT "@CMAKE_MT@")
|
||||
set(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@)
|
||||
set(CMAKE_CXX_COMPILER_LOADED 1)
|
||||
set(CMAKE_CXX_COMPILER_WORKS @CMAKE_CXX_COMPILER_WORKS@)
|
||||
set(CMAKE_CXX_ABI_COMPILED @CMAKE_CXX_ABI_COMPILED@)
|
||||
set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@)
|
||||
set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@)
|
||||
if(CMAKE_COMPILER_IS_CYGWIN)
|
||||
set(CYGWIN 1)
|
||||
set(UNIX 1)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
|
||||
|
||||
if(CMAKE_COMPILER_IS_MINGW)
|
||||
set(MINGW 1)
|
||||
endif()
|
||||
set(CMAKE_CXX_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP)
|
||||
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||
|
||||
foreach (lang C OBJC OBJCXX)
|
||||
if (CMAKE_${lang}_COMPILER_ID_RUN)
|
||||
foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS)
|
||||
list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension})
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(CMAKE_CXX_LINKER_PREFERENCE 30)
|
||||
set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
|
||||
|
||||
# Save compiler ABI information.
|
||||
set(CMAKE_CXX_SIZEOF_DATA_PTR "@CMAKE_CXX_SIZEOF_DATA_PTR@")
|
||||
set(CMAKE_CXX_COMPILER_ABI "@CMAKE_CXX_COMPILER_ABI@")
|
||||
set(CMAKE_CXX_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@")
|
||||
|
||||
if(CMAKE_CXX_SIZEOF_DATA_PTR)
|
||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ABI)
|
||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "@CMAKE_CXX_CL_SHOWINCLUDES_PREFIX@")
|
||||
if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX)
|
||||
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}")
|
||||
endif()
|
||||
|
||||
@CMAKE_CXX_COMPILER_CUSTOM_CODE@
|
||||
@CMAKE_CXX_SYSROOT_FLAG_CODE@
|
||||
@CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
|
||||
|
||||
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES@")
|
||||
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@")
|
||||
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@")
|
||||
set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef __cplusplus
|
||||
# error "A C compiler has been selected for C++."
|
||||
#endif
|
||||
|
||||
#include "CMakeCompilerABI.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int require = 0;
|
||||
require += info_sizeof_dptr[argc];
|
||||
#if defined(ABI_ID)
|
||||
require += info_abi[argc];
|
||||
#endif
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
/* This source file must have a .cpp extension so that all C++ compilers
|
||||
recognize the extension without flags. Borland does not know .cxx for
|
||||
example. */
|
||||
#ifndef __cplusplus
|
||||
# error "A C compiler has been selected for C++."
|
||||
#endif
|
||||
|
||||
@CMAKE_CXX_COMPILER_ID_CONTENT@
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
||||
#ifdef SIMULATE_ID
|
||||
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
|
||||
#endif
|
||||
|
||||
#ifdef __QNXNTO__
|
||||
char const* qnxnto = "INFO" ":" "qnxnto[]";
|
||||
#endif
|
||||
|
||||
#if defined(__CRAYXE) || defined(__CRAYXC)
|
||||
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
|
||||
#endif
|
||||
|
||||
@CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
|
||||
@CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@
|
||||
|
||||
#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L
|
||||
# if defined(__INTEL_CXX11_MODE__)
|
||||
# if defined(__cpp_aggregate_nsdmi)
|
||||
# define CXX_STD 201402L
|
||||
# else
|
||||
# define CXX_STD 201103L
|
||||
# endif
|
||||
# else
|
||||
# define CXX_STD 199711L
|
||||
# endif
|
||||
#elif defined(_MSC_VER) && defined(_MSVC_LANG)
|
||||
# define CXX_STD _MSVC_LANG
|
||||
#else
|
||||
# define CXX_STD __cplusplus
|
||||
#endif
|
||||
|
||||
const char* info_language_dialect_default = "INFO" ":" "dialect_default["
|
||||
#if CXX_STD > 201703L
|
||||
"20"
|
||||
#elif CXX_STD >= 201703L
|
||||
"17"
|
||||
#elif CXX_STD >= 201402L
|
||||
"14"
|
||||
#elif CXX_STD >= 201103L
|
||||
"11"
|
||||
#else
|
||||
"98"
|
||||
#endif
|
||||
"]";
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int require = 0;
|
||||
require += info_compiler[argc];
|
||||
require += info_platform[argc];
|
||||
#ifdef COMPILER_VERSION_MAJOR
|
||||
require += info_version[argc];
|
||||
#endif
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
require += info_version_internal[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_ID
|
||||
require += info_simulate[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
require += info_simulate_version[argc];
|
||||
#endif
|
||||
#if defined(__CRAYXE) || defined(__CRAYXC)
|
||||
require += info_cray[argc];
|
||||
#endif
|
||||
require += info_language_dialect_default[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
|
@ -0,0 +1,282 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This file sets the basic flags for the C++ language in CMake.
|
||||
# It also loads the available platform file for the system-compiler
|
||||
# if it exists.
|
||||
# It also loads a system - compiler - processor (or target hardware)
|
||||
# specific file, which is mainly useful for crosscompiling and embedded systems.
|
||||
|
||||
include(CMakeLanguageInformation)
|
||||
|
||||
# some compilers use different extensions (e.g. sdcc uses .rel)
|
||||
# so set the extension here first so it can be overridden by the compiler specific file
|
||||
if(UNIX)
|
||||
set(CMAKE_CXX_OUTPUT_EXTENSION .o)
|
||||
else()
|
||||
set(CMAKE_CXX_OUTPUT_EXTENSION .obj)
|
||||
endif()
|
||||
|
||||
set(_INCLUDED_FILE 0)
|
||||
|
||||
# Load compiler-specific information.
|
||||
if(CMAKE_CXX_COMPILER_ID)
|
||||
include(Compiler/${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL)
|
||||
endif()
|
||||
|
||||
set(CMAKE_BASE_NAME)
|
||||
get_filename_component(CMAKE_BASE_NAME "${CMAKE_CXX_COMPILER}" NAME_WE)
|
||||
# since the gnu compiler has several names force g++
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_BASE_NAME g++)
|
||||
endif()
|
||||
|
||||
|
||||
# load a hardware specific file, mostly useful for embedded compilers
|
||||
if(CMAKE_SYSTEM_PROCESSOR)
|
||||
if(CMAKE_CXX_COMPILER_ID)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-CXX-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif()
|
||||
if (NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
# load the system- and compiler specific files
|
||||
if(CMAKE_CXX_COMPILER_ID)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif()
|
||||
if (NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL
|
||||
RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif ()
|
||||
|
||||
# load any compiler-wrapper specific information
|
||||
if (CMAKE_CXX_COMPILER_WRAPPER)
|
||||
__cmake_include_compiler_wrapper(CXX)
|
||||
endif ()
|
||||
|
||||
# We specify the compiler information in the system file for some
|
||||
# platforms, but this language may not have been enabled when the file
|
||||
# was first included. Include it again to get the language info.
|
||||
# Remove this when all compiler info is removed from system files.
|
||||
if (NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
|
||||
endif ()
|
||||
|
||||
if(CMAKE_CXX_SIZEOF_DATA_PTR)
|
||||
foreach(f ${CMAKE_CXX_ABI_FILES})
|
||||
include(${f})
|
||||
endforeach()
|
||||
unset(CMAKE_CXX_ABI_FILES)
|
||||
endif()
|
||||
|
||||
# This should be included before the _INIT variables are
|
||||
# used to initialize the cache. Since the rule variables
|
||||
# have if blocks on them, users can still define them here.
|
||||
# But, it should still be after the platform file so changes can
|
||||
# be made to those values.
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE)
|
||||
# Save the full path of the file so try_compile can use it.
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX)
|
||||
# Save the full path of the file so try_compile can use it.
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX "${_override}")
|
||||
endif()
|
||||
|
||||
|
||||
# Create a set of shared library variable specific to C++
|
||||
# For 90% of the systems, these are the same flags as the C versions
|
||||
# so if these are not set just copy the flags from the c version
|
||||
if(NOT CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS)
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILE_OPTIONS_PIC)
|
||||
set(CMAKE_CXX_COMPILE_OPTIONS_PIC ${CMAKE_C_COMPILE_OPTIONS_PIC})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILE_OPTIONS_PIE)
|
||||
set(CMAKE_CXX_COMPILE_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE})
|
||||
endif()
|
||||
if(NOT CMAKE_CXX_LINK_OPTIONS_PIE)
|
||||
set(CMAKE_CXX_LINK_OPTIONS_PIE ${CMAKE_C_LINK_OPTIONS_PIE})
|
||||
endif()
|
||||
if(NOT CMAKE_CXX_LINK_OPTIONS_NO_PIE)
|
||||
set(CMAKE_CXX_LINK_OPTIONS_NO_PIE ${CMAKE_C_LINK_OPTIONS_NO_PIE})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILE_OPTIONS_DLL)
|
||||
set(CMAKE_CXX_COMPILE_OPTIONS_DLL ${CMAKE_C_COMPILE_OPTIONS_DLL})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS)
|
||||
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG)
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP)
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG)
|
||||
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_EXE_EXPORTS_CXX_FLAG)
|
||||
set(CMAKE_EXE_EXPORTS_CXX_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG)
|
||||
set(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG_SEP)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_WITH_RUNTIME_PATH)
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_INCLUDE_FLAG_CXX)
|
||||
set(CMAKE_INCLUDE_FLAG_CXX ${CMAKE_INCLUDE_FLAG_C})
|
||||
endif()
|
||||
|
||||
# for most systems a module is the same as a shared library
|
||||
# so unless the variable CMAKE_MODULE_EXISTS is set just
|
||||
# copy the values from the LIBRARY variables
|
||||
if(NOT CMAKE_MODULE_EXISTS)
|
||||
set(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
|
||||
set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS})
|
||||
endif()
|
||||
|
||||
# repeat for modules
|
||||
if(NOT CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS)
|
||||
set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_SHARED_MODULE_CXX_FLAGS)
|
||||
set(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS})
|
||||
endif()
|
||||
|
||||
# Initialize CXX link type selection flags from C versions.
|
||||
foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
|
||||
if(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS)
|
||||
set(CMAKE_${type}_LINK_STATIC_CXX_FLAGS
|
||||
${CMAKE_${type}_LINK_STATIC_C_FLAGS})
|
||||
endif()
|
||||
if(NOT CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS)
|
||||
set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS
|
||||
${CMAKE_${type}_LINK_DYNAMIC_C_FLAGS})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# add the flags to the cache based
|
||||
# on the initial values computed in the platform/*.cmake files
|
||||
# use _INIT variables so that this only happens the first time
|
||||
# and you can set these flags in the cmake cache
|
||||
set(CMAKE_CXX_FLAGS_INIT "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}")
|
||||
|
||||
cmake_initialize_per_config_variable(CMAKE_CXX_FLAGS "Flags used by the CXX compiler")
|
||||
|
||||
if(CMAKE_CXX_STANDARD_LIBRARIES_INIT)
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES_INIT}"
|
||||
CACHE STRING "Libraries linked by default with all C++ applications.")
|
||||
mark_as_advanced(CMAKE_CXX_STANDARD_LIBRARIES)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_CXX_COMPILER_LAUNCHER})
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER "$ENV{CMAKE_CXX_COMPILER_LAUNCHER}"
|
||||
CACHE STRING "Compiler launcher for CXX.")
|
||||
endif()
|
||||
|
||||
include(CMakeCommonLanguageInclude)
|
||||
|
||||
# now define the following rules:
|
||||
# CMAKE_CXX_CREATE_SHARED_LIBRARY
|
||||
# CMAKE_CXX_CREATE_SHARED_MODULE
|
||||
# CMAKE_CXX_COMPILE_OBJECT
|
||||
# CMAKE_CXX_LINK_EXECUTABLE
|
||||
|
||||
# variables supplied by the generator at use time
|
||||
# <TARGET>
|
||||
# <TARGET_BASE> the target without the suffix
|
||||
# <OBJECTS>
|
||||
# <OBJECT>
|
||||
# <LINK_LIBRARIES>
|
||||
# <FLAGS>
|
||||
# <LINK_FLAGS>
|
||||
|
||||
# CXX compiler information
|
||||
# <CMAKE_CXX_COMPILER>
|
||||
# <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS>
|
||||
# <CMAKE_CXX_SHARED_MODULE_CREATE_FLAGS>
|
||||
# <CMAKE_CXX_LINK_FLAGS>
|
||||
|
||||
# Static library tools
|
||||
# <CMAKE_AR>
|
||||
# <CMAKE_RANLIB>
|
||||
|
||||
|
||||
# create a shared C++ library
|
||||
if(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_CXX_CREATE_SHARED_LIBRARY
|
||||
"<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
# create a c++ shared module copy the shared library rule by default
|
||||
if(NOT CMAKE_CXX_CREATE_SHARED_MODULE)
|
||||
set(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
|
||||
endif()
|
||||
|
||||
|
||||
# Create a static archive incrementally for large object file counts.
|
||||
# If CMAKE_CXX_CREATE_STATIC_LIBRARY is set it will override these.
|
||||
if(NOT DEFINED CMAKE_CXX_ARCHIVE_CREATE)
|
||||
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_CXX_ARCHIVE_APPEND)
|
||||
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_CXX_ARCHIVE_FINISH)
|
||||
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
|
||||
endif()
|
||||
|
||||
# compile a C++ file into an object file
|
||||
if(NOT CMAKE_CXX_COMPILE_OBJECT)
|
||||
set(CMAKE_CXX_COMPILE_OBJECT
|
||||
"<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_LINK_EXECUTABLE)
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE
|
||||
"<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
CMAKE_VERBOSE_MAKEFILE
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_INFORMATION_LOADED 1)
|
|
@ -0,0 +1,36 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# Do NOT include this module directly into any of your code. It is meant as
|
||||
# a library for Check*CompilerFlag.cmake modules. It's content may change in
|
||||
# any way between releases.
|
||||
|
||||
macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
|
||||
set(${_VAR}
|
||||
FAIL_REGEX "[Uu]nrecogni[sz]ed .*option" # GNU, NAG
|
||||
FAIL_REGEX "switch .* is no longer supported" # GNU
|
||||
FAIL_REGEX "unknown .*option" # Clang
|
||||
FAIL_REGEX "optimization flag .* not supported" # Clang
|
||||
FAIL_REGEX "unknown argument ignored" # Clang (cl)
|
||||
FAIL_REGEX "ignoring unknown option" # MSVC, Intel
|
||||
FAIL_REGEX "warning D9002" # MSVC, any lang
|
||||
FAIL_REGEX "option.*not supported" # Intel
|
||||
FAIL_REGEX "invalid argument .*option" # Intel
|
||||
FAIL_REGEX "ignoring option .*argument required" # Intel
|
||||
FAIL_REGEX "ignoring option .*argument is of wrong type" # Intel
|
||||
FAIL_REGEX "[Uu]nknown option" # HP
|
||||
FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro
|
||||
FAIL_REGEX "command option .* is not recognized" # XL
|
||||
FAIL_REGEX "command option .* contains an incorrect subargument" # XL
|
||||
FAIL_REGEX "Option .* is not recognized. Option will be ignored." # XL
|
||||
FAIL_REGEX "not supported in this configuration. ignored" # AIX
|
||||
FAIL_REGEX "File with unknown suffix passed to linker" # PGI
|
||||
FAIL_REGEX "[Uu]nknown switch" # PGI
|
||||
FAIL_REGEX "WARNING: unknown flag:" # Open64
|
||||
FAIL_REGEX "Incorrect command line option:" # Borland
|
||||
FAIL_REGEX "Warning: illegal option" # SunStudio 12
|
||||
FAIL_REGEX "[Ww]arning: Invalid suboption" # Fujitsu
|
||||
FAIL_REGEX "An invalid option .* appears on the command line" # Cray
|
||||
)
|
||||
endmacro ()
|
|
@ -0,0 +1,23 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# this file has flags that are shared across languages and sets
|
||||
# cache values that can be initialized in the platform-compiler.cmake file
|
||||
# it may be included by more than one language.
|
||||
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " $ENV{LDFLAGS}")
|
||||
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " $ENV{LDFLAGS}")
|
||||
string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " $ENV{LDFLAGS}")
|
||||
|
||||
cmake_initialize_per_config_variable(CMAKE_EXE_LINKER_FLAGS "Flags used by the linker")
|
||||
cmake_initialize_per_config_variable(CMAKE_SHARED_LINKER_FLAGS "Flags used by the linker during the creation of shared libraries")
|
||||
cmake_initialize_per_config_variable(CMAKE_MODULE_LINKER_FLAGS "Flags used by the linker during the creation of modules")
|
||||
cmake_initialize_per_config_variable(CMAKE_STATIC_LINKER_FLAGS "Flags used by the linker during the creation of static libraries")
|
||||
|
||||
# Alias the build tool variable for backward compatibility.
|
||||
set(CMAKE_BUILD_TOOL ${CMAKE_MAKE_PROGRAM})
|
||||
|
||||
mark_as_advanced(
|
||||
CMAKE_VERBOSE_MAKEFILE
|
||||
)
|
|
@ -0,0 +1,33 @@
|
|||
|
||||
/* Size of a pointer-to-data in bytes. */
|
||||
#define SIZEOF_DPTR (sizeof(void*))
|
||||
const char info_sizeof_dptr[] = {
|
||||
/* clang-format off */
|
||||
'I', 'N', 'F', 'O', ':', 's', 'i', 'z', 'e', 'o', 'f', '_', 'd', 'p', 't',
|
||||
'r', '[', ('0' + ((SIZEOF_DPTR / 10) % 10)), ('0' + (SIZEOF_DPTR % 10)), ']',
|
||||
'\0'
|
||||
/* clang-format on */
|
||||
};
|
||||
|
||||
/* Application Binary Interface. */
|
||||
|
||||
/* Check for (some) ARM ABIs.
|
||||
* See e.g. http://wiki.debian.org/ArmEabiPort for some information on this. */
|
||||
#if defined(__GNU__) && defined(__ELF__) && defined(__ARM_EABI__)
|
||||
# define ABI_ID "ELF ARMEABI"
|
||||
#elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEB__)
|
||||
# define ABI_ID "ELF ARM"
|
||||
#elif defined(__GNU__) && defined(__ELF__) && defined(__ARMEL__)
|
||||
# define ABI_ID "ELF ARM"
|
||||
|
||||
#elif defined(__linux__) && defined(__ELF__) && defined(__amd64__) && \
|
||||
defined(__ILP32__)
|
||||
# define ABI_ID "ELF X32"
|
||||
|
||||
#elif defined(__ELF__)
|
||||
# define ABI_ID "ELF"
|
||||
#endif
|
||||
|
||||
#if defined(ABI_ID)
|
||||
static char const info_abi[] = "INFO:abi[" ABI_ID "]";
|
||||
#endif
|
|
@ -0,0 +1,151 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
function(_readFile file)
|
||||
include(${file})
|
||||
get_filename_component(name ${file} NAME_WE)
|
||||
string(REGEX REPLACE "-.*" "" CompilerId ${name})
|
||||
set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE)
|
||||
set(_compiler_id_simulate_${CompilerId} ${_compiler_id_simulate} PARENT_SCOPE)
|
||||
set(_compiler_id_pp_test_${CompilerId} ${_compiler_id_pp_test} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(compiler_id_detection outvar lang)
|
||||
|
||||
if (NOT lang STREQUAL Fortran AND NOT lang STREQUAL CSharp)
|
||||
file(GLOB lang_files
|
||||
"${CMAKE_ROOT}/Modules/Compiler/*-DetermineCompiler.cmake")
|
||||
set(nonlang CXX)
|
||||
if (lang STREQUAL CXX)
|
||||
set(nonlang C)
|
||||
endif()
|
||||
|
||||
file(GLOB nonlang_files
|
||||
"${CMAKE_ROOT}/Modules/Compiler/*-${nonlang}-DetermineCompiler.cmake")
|
||||
list(REMOVE_ITEM lang_files ${nonlang_files})
|
||||
endif()
|
||||
|
||||
set(files ${lang_files})
|
||||
if (files)
|
||||
foreach(file ${files})
|
||||
_readFile(${file})
|
||||
endforeach()
|
||||
|
||||
set(options ID_STRING VERSION_STRINGS ID_DEFINE PLATFORM_DEFAULT_COMPILER)
|
||||
set(oneValueArgs PREFIX)
|
||||
cmake_parse_arguments(CID "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
if (CID_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "Unrecognized arguments: \"${CID_UNPARSED_ARGUMENTS}\"")
|
||||
endif()
|
||||
|
||||
# Order is relevant here. For example, compilers which pretend to be
|
||||
# GCC must appear before the actual GCC.
|
||||
if (lang STREQUAL CXX)
|
||||
list(APPEND ordered_compilers
|
||||
Comeau
|
||||
)
|
||||
endif()
|
||||
list(APPEND ordered_compilers
|
||||
Intel
|
||||
PathScale
|
||||
Embarcadero
|
||||
Borland
|
||||
Watcom
|
||||
OpenWatcom
|
||||
SunPro
|
||||
HP
|
||||
Compaq
|
||||
zOS
|
||||
XLClang
|
||||
XL
|
||||
VisualAge
|
||||
PGI
|
||||
Cray
|
||||
TI
|
||||
Fujitsu
|
||||
GHS
|
||||
)
|
||||
if (lang STREQUAL C)
|
||||
list(APPEND ordered_compilers
|
||||
TinyCC
|
||||
Bruce
|
||||
)
|
||||
endif()
|
||||
list(APPEND ordered_compilers
|
||||
SCO
|
||||
ARMCC
|
||||
AppleClang
|
||||
ARMClang
|
||||
Clang
|
||||
GNU
|
||||
MSVC
|
||||
ADSP
|
||||
IAR
|
||||
)
|
||||
if (lang STREQUAL C)
|
||||
list(APPEND ordered_compilers
|
||||
SDCC
|
||||
)
|
||||
endif()
|
||||
|
||||
if(lang STREQUAL CUDA)
|
||||
set(ordered_compilers NVIDIA Clang)
|
||||
endif()
|
||||
|
||||
if(CID_ID_DEFINE)
|
||||
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")
|
||||
if (CID_VERSION_STRINGS)
|
||||
string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT "\n/* Version number components: V=Version, R=Revision, P=Patch
|
||||
Version date components: YYYY=Year, MM=Month, DD=Day */\n")
|
||||
endif()
|
||||
|
||||
foreach(Id ${ordered_compilers})
|
||||
if (NOT _compiler_id_pp_test_${Id})
|
||||
message(FATAL_ERROR "No preprocessor test for \"${Id}\"")
|
||||
endif()
|
||||
set(id_content "${pp_if} ${_compiler_id_pp_test_${Id}}\n")
|
||||
if (CID_ID_STRING)
|
||||
set(PREFIX ${CID_PREFIX})
|
||||
string(CONFIGURE "${_compiler_id_simulate_${Id}}" SIMULATE_BLOCK @ONLY)
|
||||
string(APPEND id_content "# define ${CID_PREFIX}COMPILER_ID \"${Id}\"${SIMULATE_BLOCK}")
|
||||
endif()
|
||||
if (CID_ID_DEFINE)
|
||||
string(APPEND id_content "# undef ${CID_PREFIX}COMPILER_IS_${Id}\n")
|
||||
string(APPEND id_content "# define ${CID_PREFIX}COMPILER_IS_${Id} 1\n")
|
||||
endif()
|
||||
if (CID_VERSION_STRINGS)
|
||||
set(PREFIX ${CID_PREFIX})
|
||||
set(MACRO_DEC DEC)
|
||||
set(MACRO_HEX HEX)
|
||||
string(CONFIGURE "${_compiler_id_version_compute_${Id}}" VERSION_BLOCK @ONLY)
|
||||
string(APPEND id_content "${VERSION_BLOCK}\n")
|
||||
endif()
|
||||
string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT "\n${id_content}")
|
||||
set(pp_if "#elif")
|
||||
endforeach()
|
||||
|
||||
if (CID_PLATFORM_DEFAULT_COMPILER)
|
||||
set(platform_compiler_detection "
|
||||
/* These compilers are either not known or too old to define an
|
||||
identification macro. Try to identify the platform and guess that
|
||||
it is the native compiler. */
|
||||
#elif defined(__hpux) || defined(__hpua)
|
||||
# define ${CID_PREFIX}COMPILER_ID \"HP\"
|
||||
|
||||
#else /* unknown compiler */
|
||||
# define ${CID_PREFIX}COMPILER_ID \"\"")
|
||||
endif()
|
||||
|
||||
string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT "\n${platform_compiler_detection}\n#endif")
|
||||
endif()
|
||||
|
||||
set(${outvar} ${CMAKE_${lang}_COMPILER_ID_CONTENT} PARENT_SCOPE)
|
||||
endfunction()
|
|
@ -0,0 +1 @@
|
|||
@CMAKE_CONFIGURABLE_FILE_CONTENT@
|
|
@ -0,0 +1,51 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
CMakeDependentOption
|
||||
--------------------
|
||||
|
||||
Macro to provide an option dependent on other options.
|
||||
|
||||
This macro presents an option to the user only if a set of other
|
||||
conditions are true. When the option is not presented a default value
|
||||
is used, but any value set by the user is preserved for when the
|
||||
option is presented again. Example invocation:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
CMAKE_DEPENDENT_OPTION(USE_FOO "Use Foo" ON
|
||||
"USE_BAR;NOT USE_ZOT" OFF)
|
||||
|
||||
If USE_BAR is true and USE_ZOT is false, this provides an option
|
||||
called USE_FOO that defaults to ON. Otherwise, it sets USE_FOO to
|
||||
OFF. If the status of USE_BAR or USE_ZOT ever changes, any value for
|
||||
the USE_FOO option is saved so that when the option is re-enabled it
|
||||
retains its old value. Each element in the fourth parameter is
|
||||
evaluated as an if-condition, so :ref:`Condition Syntax` can be used.
|
||||
#]=======================================================================]
|
||||
|
||||
macro(CMAKE_DEPENDENT_OPTION option doc default depends force)
|
||||
if(${option}_ISSET MATCHES "^${option}_ISSET$")
|
||||
set(${option}_AVAILABLE 1)
|
||||
foreach(d ${depends})
|
||||
string(REGEX REPLACE " +" ";" CMAKE_DEPENDENT_OPTION_DEP "${d}")
|
||||
if(${CMAKE_DEPENDENT_OPTION_DEP})
|
||||
else()
|
||||
set(${option}_AVAILABLE 0)
|
||||
endif()
|
||||
endforeach()
|
||||
if(${option}_AVAILABLE)
|
||||
option(${option} "${doc}" "${default}")
|
||||
set(${option} "${${option}}" CACHE BOOL "${doc}" FORCE)
|
||||
else()
|
||||
if(${option} MATCHES "^${option}$")
|
||||
else()
|
||||
set(${option} "${${option}}" CACHE INTERNAL "${doc}")
|
||||
endif()
|
||||
set(${option} ${force})
|
||||
endif()
|
||||
else()
|
||||
set(${option} "${${option}_ISSET}")
|
||||
endif()
|
||||
endmacro()
|
|
@ -0,0 +1,10 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# determine the compiler to use for ASM using AT&T syntax, e.g. GNU as
|
||||
|
||||
set(ASM_DIALECT "-ATT")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gas ${_CMAKE_TOOLCHAIN_PREFIX}as)
|
||||
include(CMakeDetermineASMCompiler)
|
||||
set(ASM_DIALECT)
|
|
@ -0,0 +1,253 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# determine the compiler to use for ASM programs
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
|
||||
|
||||
if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
||||
# prefer the environment variable ASM
|
||||
if(NOT $ENV{ASM${ASM_DIALECT}} STREQUAL "")
|
||||
get_filename_component(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT $ENV{ASM${ASM_DIALECT}} PROGRAM PROGRAM_ARGS CMAKE_ASM${ASM_DIALECT}_FLAGS_ENV_INIT)
|
||||
if(CMAKE_ASM${ASM_DIALECT}_FLAGS_ENV_INIT)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_FLAGS_ENV_INIT}" CACHE STRING "First argument to ASM${ASM_DIALECT} compiler")
|
||||
endif()
|
||||
if(NOT EXISTS ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT})
|
||||
message(FATAL_ERROR "Could not find compiler set in environment variable ASM${ASM_DIALECT}:\n$ENV{ASM${ASM_DIALECT}}.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# finally list compilers to try
|
||||
if("ASM${ASM_DIALECT}" STREQUAL "ASM") # the generic assembler support
|
||||
if(NOT CMAKE_ASM_COMPILER_INIT)
|
||||
if(CMAKE_C_COMPILER)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_C_COMPILER})
|
||||
elseif(CMAKE_CXX_COMPILER)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_CXX_COMPILER})
|
||||
else()
|
||||
# List all default C and CXX compilers
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST
|
||||
${_CMAKE_TOOLCHAIN_PREFIX}cc ${_CMAKE_TOOLCHAIN_PREFIX}gcc cl bcc xlc
|
||||
CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC)
|
||||
endif()
|
||||
endif()
|
||||
else() # some specific assembler "dialect"
|
||||
if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT AND NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST)
|
||||
message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT or CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST must be preset !")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Find the compiler.
|
||||
_cmake_find_compiler(ASM${ASM_DIALECT})
|
||||
|
||||
else()
|
||||
_cmake_find_compiler_path(ASM${ASM_DIALECT})
|
||||
endif()
|
||||
mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
||||
|
||||
if (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
||||
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH)
|
||||
endif ()
|
||||
|
||||
|
||||
if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||
|
||||
# Table of per-vendor compiler id flags with expected output.
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "(GNU assembler)|(GCC)|(Free Software Foundation)")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Clang )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Clang "--version")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Clang "(clang version)")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS AppleClang )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_AppleClang "--version")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_AppleClang "(Apple LLVM version)")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS ARMClang )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ARMClang "--version")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMClang "armclang")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS HP )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_HP "-V")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_HP "HP C")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Intel )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Intel "--version")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Intel "(ICC)")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS SunPro )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_SunPro "-V")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_SunPro "Sun C")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS XL )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_XL "-qversion")
|
||||
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_REGEX_MSVC "Microsoft")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI "-h")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI "Texas Instruments")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS IAR)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_IAR )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_IAR "IAR Assembler")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS ARMCC)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_ARMCC )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_ARMCC "(ARM Compiler)|(ARM Assembler)")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS NASM)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_NASM "-v")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_NASM "(NASM version)")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS YASM)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_YASM "--version")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_YASM "(yasm)")
|
||||
|
||||
list(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS ADSP)
|
||||
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}")
|
||||
if("x${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}" STREQUAL "xIAR")
|
||||
# primary necessary to detect architecture, so the right archiver and linker can be picked
|
||||
# eg. "IAR Assembler V8.10.1.12857/W32 for ARM" or "IAR Assembler V4.11.1.4666 for Renesas RX"
|
||||
# Cut out identification first, newline handling is a pain
|
||||
string(REGEX MATCH "IAR Assembler[^\r\n]*" _compileid "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_OUTPUT}")
|
||||
if("${_compileid}" MATCHES "V([0-9]+\\.[0-9]+\\.[0-9]+)")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_VERSION ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
string(REGEX MATCHALL "([A-Za-z0-9-]+)" _all_compileid_matches "${_compileid}")
|
||||
if(_all_compileid_matches)
|
||||
list(GET _all_compileid_matches "-1" CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
_cmake_find_compiler_sysroot(ASM${ASM_DIALECT})
|
||||
|
||||
unset(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_OUTPUT)
|
||||
unset(_all_compileid_matches)
|
||||
unset(_compileid)
|
||||
endif()
|
||||
|
||||
if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||
if(CMAKE_ASM${ASM_DIALECT}_COMPILER_VERSION)
|
||||
set(_version " ${CMAKE_ASM${ASM_DIALECT}_COMPILER_VERSION}")
|
||||
else()
|
||||
set(_version "")
|
||||
endif()
|
||||
if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID AND "x${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}" STREQUAL "xIAR")
|
||||
set(_archid " ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}")
|
||||
else()
|
||||
set(_archid "")
|
||||
endif()
|
||||
message(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}${_archid}${_version}")
|
||||
unset(_archid)
|
||||
unset(_version)
|
||||
else()
|
||||
message(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown")
|
||||
endif()
|
||||
|
||||
# If we have a gas/as cross compiler, they have usually some prefix, like
|
||||
# e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas , optionally
|
||||
# with a 3-component version number at the end
|
||||
# The other tools of the toolchain usually have the same prefix
|
||||
# NAME_WE cannot be used since then this test will fail for names like
|
||||
# "arm-unknown-nto-qnx6.3.0-gas.exe", where BASENAME would be
|
||||
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
|
||||
if (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||
get_filename_component(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME)
|
||||
if (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Now try the C compiler regexp:
|
||||
if (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||
if (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Finally try the CXX compiler regexp:
|
||||
if (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||
if (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
||||
set(_CMAKE_PROCESSING_LANGUAGE "ASM")
|
||||
include(CMakeFindBinUtils)
|
||||
include(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-FindBinUtils OPTIONAL)
|
||||
unset(_CMAKE_PROCESSING_LANGUAGE)
|
||||
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR "ASM${ASM_DIALECT}")
|
||||
|
||||
if(CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
||||
message(STATUS "Found assembler: ${CMAKE_ASM${ASM_DIALECT}_COMPILER}")
|
||||
else()
|
||||
message(STATUS "Didn't find assembler")
|
||||
endif()
|
||||
|
||||
foreach(_var
|
||||
COMPILER
|
||||
COMPILER_ID
|
||||
COMPILER_ARG1
|
||||
COMPILER_ENV_VAR
|
||||
COMPILER_AR
|
||||
COMPILER_RANLIB
|
||||
COMPILER_VERSION
|
||||
)
|
||||
set(_CMAKE_ASM_${_var} "${CMAKE_ASM${ASM_DIALECT}_${_var}}")
|
||||
endforeach()
|
||||
|
||||
if(CMAKE_ASM${ASM_DIALECT}_COMPILER_SYSROOT)
|
||||
string(CONCAT _SET_CMAKE_ASM_COMPILER_SYSROOT
|
||||
"set(CMAKE_ASM${ASM_DIALECT}_COMPILER_SYSROOT \"${CMAKE_ASM${ASM_DIALECT}_COMPILER_SYSROOT}\")\n"
|
||||
"set(CMAKE_COMPILER_SYSROOT \"${CMAKE_ASM${ASM_DIALECT}_COMPILER_SYSROOT}\")")
|
||||
else()
|
||||
set(_SET_CMAKE_ASM_COMPILER_SYSROOT "")
|
||||
endif()
|
||||
|
||||
if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH)
|
||||
set(_SET_CMAKE_ASM_COMPILER_ID_VENDOR_MATCH
|
||||
"set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH [==[${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_MATCH}]==])")
|
||||
else()
|
||||
set(_SET_CMAKE_ASM_COMPILER_ID_VENDOR_MATCH "")
|
||||
endif()
|
||||
|
||||
if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID)
|
||||
set(_SET_CMAKE_ASM_COMPILER_ARCHITECTURE_ID
|
||||
"set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID})")
|
||||
else()
|
||||
set(_SET_CMAKE_ASM_COMPILER_ARCHITECTURE_ID "")
|
||||
endif()
|
||||
|
||||
# configure variables set in this file for fast reload later on
|
||||
configure_file(${CMAKE_ROOT}/Modules/CMakeASMCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeASM${ASM_DIALECT}Compiler.cmake @ONLY)
|
||||
|
||||
foreach(_var
|
||||
COMPILER
|
||||
COMPILER_ID
|
||||
COMPILER_ARG1
|
||||
COMPILER_ENV_VAR
|
||||
COMPILER_AR
|
||||
COMPILER_RANLIB
|
||||
COMPILER_VERSION
|
||||
)
|
||||
unset(_CMAKE_ASM_${_var})
|
||||
endforeach()
|
|
@ -0,0 +1,18 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# Find the MS assembler (masm or masm64)
|
||||
|
||||
set(ASM_DIALECT "_MASM")
|
||||
|
||||
# if we are using the 64bit cl compiler, assume we also want the 64bit assembler
|
||||
if(";${CMAKE_VS_PLATFORM_NAME};${MSVC_C_ARCHITECTURE_ID};${MSVC_CXX_ARCHITECTURE_ID};"
|
||||
MATCHES ";(Win64|Itanium|x64|IA64);")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml64)
|
||||
else()
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml)
|
||||
endif()
|
||||
|
||||
include(CMakeDetermineASMCompiler)
|
||||
set(ASM_DIALECT)
|
|
@ -0,0 +1,30 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# Find the nasm assembler. yasm (http://www.tortall.net/projects/yasm/) is nasm compatible
|
||||
|
||||
set(CMAKE_ASM_NASM_COMPILER_LIST nasm yasm)
|
||||
|
||||
if(NOT CMAKE_ASM_NASM_COMPILER)
|
||||
set(_CMAKE_ENV_VARX86 "ProgramFiles(x86)")
|
||||
set(_CMAKE_ASM_NASM_COMPILER_PATHS
|
||||
"[HKEY_CURRENT_USER\\SOFTWARE\\nasm]"
|
||||
"$ENV{ProgramFiles}/NASM"
|
||||
"$ENV{${ENV_VARX86}}/NASM"
|
||||
"$ENV{LOCALAPPDATA}/NASM"
|
||||
)
|
||||
find_program(CMAKE_ASM_NASM_COMPILER
|
||||
NAMES ${CMAKE_ASM_NASM_COMPILER_LIST}
|
||||
PATHS ${_CMAKE_ASM_NASM_COMPILER_PATHS}
|
||||
NO_DEFAULT_PATH
|
||||
DOC "NASM compiler"
|
||||
)
|
||||
unset(_CMAKE_ENV_VARX86)
|
||||
unset(_CMAKE_ASM_NASM_COMPILER_PATHS)
|
||||
endif()
|
||||
|
||||
# Load the generic DetermineASM compiler file with the DIALECT set properly:
|
||||
set(ASM_DIALECT "_NASM")
|
||||
include(CMakeDetermineASMCompiler)
|
||||
set(ASM_DIALECT)
|
|
@ -0,0 +1,226 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# determine the compiler to use for C programs
|
||||
# NOTE, a generator may set CMAKE_C_COMPILER before
|
||||
# loading this file to force a compiler.
|
||||
# use environment variable CC first if defined by user, next use
|
||||
# the cmake variable CMAKE_GENERATOR_CC which can be defined by a generator
|
||||
# as a default compiler
|
||||
# If the internal cmake variable _CMAKE_TOOLCHAIN_PREFIX is set, this is used
|
||||
# as prefix for the tools (e.g. arm-elf-gcc, arm-elf-ar etc.). This works
|
||||
# currently with the GNU crosscompilers.
|
||||
#
|
||||
# Sets the following variables:
|
||||
# CMAKE_C_COMPILER
|
||||
# CMAKE_AR
|
||||
# CMAKE_RANLIB
|
||||
# CMAKE_COMPILER_IS_GNUCC
|
||||
#
|
||||
# If not already set before, it also sets
|
||||
# _CMAKE_TOOLCHAIN_PREFIX
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
|
||||
|
||||
# Load system-specific compiler preferences for this language.
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-Determine-C OPTIONAL)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-C OPTIONAL)
|
||||
if(NOT CMAKE_C_COMPILER_NAMES)
|
||||
set(CMAKE_C_COMPILER_NAMES cc)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
|
||||
elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
|
||||
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
|
||||
set(CMAKE_C_COMPILER_XCODE_TYPE sourcecode.c.c)
|
||||
_cmake_find_compiler_path(C)
|
||||
else()
|
||||
if(NOT CMAKE_C_COMPILER)
|
||||
set(CMAKE_C_COMPILER_INIT NOTFOUND)
|
||||
|
||||
# prefer the environment variable CC
|
||||
if(NOT $ENV{CC} STREQUAL "")
|
||||
get_filename_component(CMAKE_C_COMPILER_INIT $ENV{CC} PROGRAM PROGRAM_ARGS CMAKE_C_FLAGS_ENV_INIT)
|
||||
if(CMAKE_C_FLAGS_ENV_INIT)
|
||||
set(CMAKE_C_COMPILER_ARG1 "${CMAKE_C_FLAGS_ENV_INIT}" CACHE STRING "First argument to C compiler")
|
||||
endif()
|
||||
if(NOT EXISTS ${CMAKE_C_COMPILER_INIT})
|
||||
message(FATAL_ERROR "Could not find compiler set in environment variable CC:\n$ENV{CC}.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# next try prefer the compiler specified by the generator
|
||||
if(CMAKE_GENERATOR_CC)
|
||||
if(NOT CMAKE_C_COMPILER_INIT)
|
||||
set(CMAKE_C_COMPILER_INIT ${CMAKE_GENERATOR_CC})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# finally list compilers to try
|
||||
if(NOT CMAKE_C_COMPILER_INIT)
|
||||
set(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}cc ${_CMAKE_TOOLCHAIN_PREFIX}gcc cl bcc xlc clang)
|
||||
endif()
|
||||
|
||||
_cmake_find_compiler(C)
|
||||
|
||||
else()
|
||||
_cmake_find_compiler_path(C)
|
||||
endif()
|
||||
mark_as_advanced(CMAKE_C_COMPILER)
|
||||
|
||||
# Each entry in this list is a set of extra flags to try
|
||||
# adding to the compile line to see if it helps produce
|
||||
# a valid identification file.
|
||||
set(CMAKE_C_COMPILER_ID_TEST_FLAGS_FIRST)
|
||||
set(CMAKE_C_COMPILER_ID_TEST_FLAGS
|
||||
# Try compiling to an object file only.
|
||||
"-c"
|
||||
|
||||
# Try enabling ANSI mode on HP.
|
||||
"-Aa"
|
||||
|
||||
# Try compiling K&R-compatible code (needed by Bruce C Compiler).
|
||||
"-D__CLASSIC_C__"
|
||||
|
||||
# ARMClang need target options
|
||||
"--target=arm-arm-none-eabi -mcpu=cortex-m3"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Build a small source file to identify the compiler.
|
||||
if(NOT CMAKE_C_COMPILER_ID_RUN)
|
||||
set(CMAKE_C_COMPILER_ID_RUN 1)
|
||||
|
||||
# Try to identify the compiler.
|
||||
set(CMAKE_C_COMPILER_ID)
|
||||
set(CMAKE_C_PLATFORM_ID)
|
||||
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
|
||||
CMAKE_C_COMPILER_ID_PLATFORM_CONTENT)
|
||||
|
||||
# The IAR compiler produces weird output.
|
||||
# See https://gitlab.kitware.com/cmake/cmake/-/issues/10176#note_153591
|
||||
list(APPEND CMAKE_C_COMPILER_ID_VENDORS IAR)
|
||||
set(CMAKE_C_COMPILER_ID_VENDOR_FLAGS_IAR )
|
||||
set(CMAKE_C_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler")
|
||||
|
||||
# Match the link line from xcodebuild output of the form
|
||||
# Ld ...
|
||||
# ...
|
||||
# /path/to/cc ...CompilerIdC/...
|
||||
# to extract the compiler front-end for the language.
|
||||
set(CMAKE_C_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdC/(\\./)?(CompilerIdC.(framework|xctest)/)?CompilerIdC[ \t\n\\\"]")
|
||||
set(CMAKE_C_COMPILER_ID_TOOL_MATCH_INDEX 2)
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
|
||||
CMAKE_DETERMINE_COMPILER_ID(C CFLAGS CMakeCCompilerId.c)
|
||||
|
||||
_cmake_find_compiler_sysroot(C)
|
||||
|
||||
# Set old compiler and platform id variables.
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_COMPILER_IS_GNUCC 1)
|
||||
endif()
|
||||
if(CMAKE_C_PLATFORM_ID MATCHES "MinGW")
|
||||
set(CMAKE_COMPILER_IS_MINGW 1)
|
||||
elseif(CMAKE_C_PLATFORM_ID MATCHES "Cygwin")
|
||||
set(CMAKE_COMPILER_IS_CYGWIN 1)
|
||||
endif()
|
||||
else()
|
||||
if(NOT DEFINED CMAKE_C_COMPILER_FRONTEND_VARIANT)
|
||||
# Some toolchain files set our internal CMAKE_C_COMPILER_ID_RUN
|
||||
# variable but are not aware of CMAKE_C_COMPILER_FRONTEND_VARIANT.
|
||||
# They pre-date our support for the GNU-like variant targeting the
|
||||
# MSVC ABI so we do not consider that here.
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "MSVC")
|
||||
else()
|
||||
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
||||
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH)
|
||||
endif ()
|
||||
|
||||
# If we have a gcc cross compiler, they have usually some prefix, like
|
||||
# e.g. powerpc-linux-gcc, arm-elf-gcc or i586-mingw32msvc-gcc, optionally
|
||||
# with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2).
|
||||
# The other tools of the toolchain usually have the same prefix
|
||||
# NAME_WE cannot be used since then this test will fail for names like
|
||||
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
|
||||
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
|
||||
if (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]+)*)?(-[^.]+)?(\\.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}-)
|
||||
endif()
|
||||
elseif(COMPILER_BASENAME MATCHES "qcc(\\.exe)?$")
|
||||
if(CMAKE_C_COMPILER_TARGET MATCHES "gcc_nto([a-z0-9]+_[0-9]+|[^_le]+)(le)?")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
|
||||
# but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
|
||||
if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||
endif ()
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "TI")
|
||||
# TI compilers are named e.g. cl6x, cl470 or armcl.exe
|
||||
get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
|
||||
if (COMPILER_BASENAME MATCHES "^(.+)?cl([^.]+)?(\\.exe)?$")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX "${CMAKE_MATCH_1}")
|
||||
set(_CMAKE_TOOLCHAIN_SUFFIX "${CMAKE_MATCH_2}")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
endif ()
|
||||
|
||||
set(_CMAKE_PROCESSING_LANGUAGE "C")
|
||||
include(CMakeFindBinUtils)
|
||||
include(Compiler/${CMAKE_C_COMPILER_ID}-FindBinUtils OPTIONAL)
|
||||
unset(_CMAKE_PROCESSING_LANGUAGE)
|
||||
|
||||
if(CMAKE_C_COMPILER_SYSROOT)
|
||||
string(CONCAT _SET_CMAKE_C_COMPILER_SYSROOT
|
||||
"set(CMAKE_C_COMPILER_SYSROOT \"${CMAKE_C_COMPILER_SYSROOT}\")\n"
|
||||
"set(CMAKE_COMPILER_SYSROOT \"${CMAKE_C_COMPILER_SYSROOT}\")")
|
||||
else()
|
||||
set(_SET_CMAKE_C_COMPILER_SYSROOT "")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ARCHITECTURE_ID)
|
||||
set(_SET_CMAKE_C_COMPILER_ARCHITECTURE_ID
|
||||
"set(CMAKE_C_COMPILER_ARCHITECTURE_ID ${CMAKE_C_COMPILER_ARCHITECTURE_ID})")
|
||||
else()
|
||||
set(_SET_CMAKE_C_COMPILER_ARCHITECTURE_ID "")
|
||||
endif()
|
||||
|
||||
if(MSVC_C_ARCHITECTURE_ID)
|
||||
set(SET_MSVC_C_ARCHITECTURE_ID
|
||||
"set(MSVC_C_ARCHITECTURE_ID ${MSVC_C_ARCHITECTURE_ID})")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_XCODE_ARCHS)
|
||||
set(SET_CMAKE_XCODE_ARCHS
|
||||
"set(CMAKE_XCODE_ARCHS \"${CMAKE_C_XCODE_ARCHS}\")")
|
||||
endif()
|
||||
|
||||
# configure variables set in this file for fast reload later on
|
||||
configure_file(${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake
|
||||
@ONLY
|
||||
)
|
||||
set(CMAKE_C_COMPILER_ENV_VAR "CC")
|
|
@ -0,0 +1,42 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
if(NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])")
|
||||
message(FATAL_ERROR
|
||||
"C# is currently only supported for Microsoft Visual Studio 2010 and later.")
|
||||
endif()
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
|
||||
#include(Platform/${CMAKE_SYSTEM_NAME}-Determine-CSharp OPTIONAL)
|
||||
#include(Platform/${CMAKE_SYSTEM_NAME}-CSharp OPTIONAL)
|
||||
if(NOT CMAKE_CSharp_COMPILER_NAMES)
|
||||
set(CMAKE_CSharp_COMPILER_NAMES csc)
|
||||
endif()
|
||||
|
||||
# Build a small source file to identify the compiler.
|
||||
if(NOT CMAKE_CSharp_COMPILER_ID_RUN)
|
||||
set(CMAKE_CSharp_COMPILER_ID_RUN 1)
|
||||
|
||||
# Try to identify the compiler.
|
||||
set(CMAKE_CSharp_COMPILER_ID)
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
|
||||
CMAKE_DETERMINE_COMPILER_ID(CSharp CSFLAGS CMakeCSharpCompilerId.cs)
|
||||
|
||||
execute_process(COMMAND "${CMAKE_CSharp_COMPILER}" "/help /preferreduilang:en-US" OUTPUT_VARIABLE output)
|
||||
string(REPLACE "\n" ";" output "${output}")
|
||||
foreach(line ${output})
|
||||
string(TOUPPER ${line} line)
|
||||
string(REGEX REPLACE "^.*COMPILER.*VERSION[^\\.0-9]*([\\.0-9]+).*$" "\\1" version "${line}")
|
||||
if(version AND NOT "x${line}" STREQUAL "x${version}")
|
||||
set(CMAKE_CSharp_COMPILER_VERSION ${version})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
message(STATUS "The CSharp compiler version is ${CMAKE_CSharp_COMPILER_VERSION}")
|
||||
endif()
|
||||
|
||||
# configure variables set in this file for fast reload later on
|
||||
configure_file(${CMAKE_ROOT}/Modules/CMakeCSharpCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeCSharpCompiler.cmake
|
||||
@ONLY
|
||||
)
|
|
@ -0,0 +1,575 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
|
||||
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
|
||||
|
||||
if( NOT ( ("${CMAKE_GENERATOR}" MATCHES "Make") OR
|
||||
("${CMAKE_GENERATOR}" MATCHES "Ninja") OR
|
||||
("${CMAKE_GENERATOR}" MATCHES "Visual Studio (1|[9][0-9])") ) )
|
||||
message(FATAL_ERROR "CUDA language not currently supported by \"${CMAKE_GENERATOR}\" generator")
|
||||
endif()
|
||||
|
||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
|
||||
else()
|
||||
if(NOT CMAKE_CUDA_COMPILER)
|
||||
set(CMAKE_CUDA_COMPILER_INIT NOTFOUND)
|
||||
|
||||
# prefer the environment variable CUDACXX
|
||||
if(NOT $ENV{CUDACXX} STREQUAL "")
|
||||
get_filename_component(CMAKE_CUDA_COMPILER_INIT $ENV{CUDACXX} PROGRAM PROGRAM_ARGS CMAKE_CUDA_FLAGS_ENV_INIT)
|
||||
if(CMAKE_CUDA_FLAGS_ENV_INIT)
|
||||
set(CMAKE_CUDA_COMPILER_ARG1 "${CMAKE_CUDA_FLAGS_ENV_INIT}" CACHE STRING "First argument to CXX compiler")
|
||||
endif()
|
||||
if(NOT EXISTS ${CMAKE_CUDA_COMPILER_INIT})
|
||||
message(FATAL_ERROR "Could not find compiler set in environment variable CUDACXX:\n$ENV{CUDACXX}.\n${CMAKE_CUDA_COMPILER_INIT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# finally list compilers to try
|
||||
if(NOT CMAKE_CUDA_COMPILER_INIT)
|
||||
set(CMAKE_CUDA_COMPILER_LIST nvcc)
|
||||
endif()
|
||||
|
||||
_cmake_find_compiler(CUDA)
|
||||
else()
|
||||
_cmake_find_compiler_path(CUDA)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CMAKE_CUDA_COMPILER)
|
||||
endif()
|
||||
|
||||
#Allow the user to specify a host compiler
|
||||
if(NOT $ENV{CUDAHOSTCXX} STREQUAL "")
|
||||
get_filename_component(CMAKE_CUDA_HOST_COMPILER $ENV{CUDAHOSTCXX} PROGRAM)
|
||||
if(NOT EXISTS ${CMAKE_CUDA_HOST_COMPILER})
|
||||
message(FATAL_ERROR "Could not find compiler set in environment variable CUDAHOSTCXX:\n$ENV{CUDAHOSTCXX}.\n${CMAKE_CUDA_HOST_COMPILER}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Build a small source file to identify the compiler.
|
||||
if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
|
||||
set(CMAKE_CUDA_COMPILER_ID_RUN 1)
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
|
||||
|
||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
|
||||
# We will not know CMAKE_CUDA_COMPILER until the main compiler id step
|
||||
# below extracts it, but we do know that the compiler id will be NVIDIA.
|
||||
set(CMAKE_CUDA_COMPILER_ID "NVIDIA")
|
||||
else()
|
||||
# We determine the vendor to help with find the toolkit and use the right flags for detection right away.
|
||||
# The main compiler identification is still needed below to extract other information.
|
||||
list(APPEND CMAKE_CUDA_COMPILER_ID_VENDORS NVIDIA Clang)
|
||||
set(CMAKE_CUDA_COMPILER_ID_VENDOR_REGEX_NVIDIA "nvcc: NVIDIA \\(R\\) Cuda compiler driver")
|
||||
set(CMAKE_CUDA_COMPILER_ID_VENDOR_REGEX_Clang "(clang version)")
|
||||
CMAKE_DETERMINE_COMPILER_ID_VENDOR(CUDA "--version")
|
||||
|
||||
# Find the CUDA toolkit. We store the CMAKE_CUDA_COMPILER_TOOLKIT_ROOT and CMAKE_CUDA_COMPILER_LIBRARY_ROOT
|
||||
# in CMakeCUDACompiler.cmake, so FindCUDAToolkit can avoid searching on future runs and the toolkit stays the same.
|
||||
# This is very similar to FindCUDAToolkit, but somewhat simplified since we can issue fatal errors
|
||||
# if we fail to find things we need and we don't need to account for searching the libraries.
|
||||
|
||||
# For NVCC we can easily deduce the SDK binary directory from the compiler path.
|
||||
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
|
||||
set(_CUDA_NVCC_EXECUTABLE "${CMAKE_CUDA_COMPILER}")
|
||||
else()
|
||||
# Search using CUDAToolkit_ROOT and then CUDA_PATH for equivalence with FindCUDAToolkit.
|
||||
# In FindCUDAToolkit CUDAToolkit_ROOT is searched automatically due to being in a find_package().
|
||||
# First we search candidate non-default paths to give them priority.
|
||||
find_program(_CUDA_NVCC_EXECUTABLE
|
||||
NAMES nvcc nvcc.exe
|
||||
PATHS ${CUDAToolkit_ROOT}
|
||||
ENV CUDAToolkit_ROOT
|
||||
ENV CUDA_PATH
|
||||
PATH_SUFFIXES bin
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
# If we didn't find NVCC, then try the default paths.
|
||||
find_program(_CUDA_NVCC_EXECUTABLE
|
||||
NAMES nvcc nvcc.exe
|
||||
PATH_SUFFIXES bin
|
||||
)
|
||||
|
||||
# If the user specified CUDAToolkit_ROOT but nvcc could not be found, this is an error.
|
||||
if(NOT _CUDA_NVCC_EXECUTABLE AND (DEFINED CUDAToolkit_ROOT OR DEFINED ENV{CUDAToolkit_ROOT}))
|
||||
set(fail_base "Could not find nvcc executable in path specified by")
|
||||
|
||||
if(DEFINED CUDAToolkit_ROOT)
|
||||
message(FATAL_ERROR "${fail_base} CUDAToolkit_ROOT=${CUDAToolkit_ROOT}")
|
||||
elseif(DEFINED ENV{CUDAToolkit_ROOT})
|
||||
message(FATAL_ERROR "${fail_base} environment variable CUDAToolkit_ROOT=$ENV{CUDAToolkit_ROOT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# CUDAToolkit_ROOT cmake/env variable not specified, try platform defaults.
|
||||
#
|
||||
# - Linux: /usr/local/cuda-X.Y
|
||||
# - macOS: /Developer/NVIDIA/CUDA-X.Y
|
||||
# - Windows: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vX.Y
|
||||
#
|
||||
# We will also search the default symlink location /usr/local/cuda first since
|
||||
# if CUDAToolkit_ROOT is not specified, it is assumed that the symlinked
|
||||
# directory is the desired location.
|
||||
if(NOT _CUDA_NVCC_EXECUTABLE)
|
||||
if(UNIX)
|
||||
if(NOT APPLE)
|
||||
set(platform_base "/usr/local/cuda-")
|
||||
else()
|
||||
set(platform_base "/Developer/NVIDIA/CUDA-")
|
||||
endif()
|
||||
else()
|
||||
set(platform_base "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v")
|
||||
endif()
|
||||
|
||||
# Build out a descending list of possible cuda installations, e.g.
|
||||
file(GLOB possible_paths "${platform_base}*")
|
||||
# Iterate the glob results and create a descending list.
|
||||
set(versions)
|
||||
foreach(p ${possible_paths})
|
||||
# Extract version number from end of string
|
||||
string(REGEX MATCH "[0-9][0-9]?\\.[0-9]$" p_version ${p})
|
||||
if(IS_DIRECTORY ${p} AND p_version)
|
||||
list(APPEND versions ${p_version})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Sort numerically in descending order, so we try the newest versions first.
|
||||
list(SORT versions COMPARE NATURAL ORDER DESCENDING)
|
||||
|
||||
# With a descending list of versions, populate possible paths to search.
|
||||
set(search_paths)
|
||||
foreach(v ${versions})
|
||||
list(APPEND search_paths "${platform_base}${v}")
|
||||
endforeach()
|
||||
|
||||
# Force the global default /usr/local/cuda to the front on Unix.
|
||||
if(UNIX)
|
||||
list(INSERT search_paths 0 "/usr/local/cuda")
|
||||
endif()
|
||||
|
||||
# Now search for nvcc again using the platform default search paths.
|
||||
find_program(_CUDA_NVCC_EXECUTABLE
|
||||
NAMES nvcc nvcc.exe
|
||||
PATHS ${search_paths}
|
||||
PATH_SUFFIXES bin
|
||||
)
|
||||
|
||||
# We are done with these variables now, cleanup.
|
||||
unset(platform_base)
|
||||
unset(possible_paths)
|
||||
unset(versions)
|
||||
unset(search_paths)
|
||||
|
||||
if(NOT _CUDA_NVCC_EXECUTABLE)
|
||||
message(FATAL_ERROR "Could not find nvcc, please set CUDAToolkit_ROOT.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${_CUDA_NVCC_EXECUTABLE}" DIRECTORY)
|
||||
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}" DIRECTORY)
|
||||
|
||||
# CMAKE_CUDA_COMPILER_LIBRARY_ROOT contains the device library and version file.
|
||||
# In a non-scattered installation this is equivalent to CMAKE_CUDA_COMPILER_TOOLKIT_ROOT.
|
||||
# We first check for a non-scattered installation to prefer it over a scattered installation.
|
||||
if(EXISTS "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/version.txt")
|
||||
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}")
|
||||
elseif(CMAKE_SYSROOT_LINK AND EXISTS "${CMAKE_SYSROOT_LINK}/usr/lib/cuda/version.txt")
|
||||
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT_LINK}/usr/lib/cuda")
|
||||
elseif(EXISTS "${CMAKE_SYSROOT}/usr/lib/cuda/version.txt")
|
||||
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_SYSROOT}/usr/lib/cuda")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_CUDA_COMPILER_ID_FLAGS_ALWAYS "-v")
|
||||
|
||||
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
|
||||
set(nvcc_test_flags "--keep --keep-dir tmp")
|
||||
if(CMAKE_CUDA_HOST_COMPILER)
|
||||
string(APPEND nvcc_test_flags " -ccbin=\"${CMAKE_CUDA_HOST_COMPILER}\"")
|
||||
endif()
|
||||
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
|
||||
if(WIN32)
|
||||
message(FATAL_ERROR "Clang with CUDA is not yet supported on Windows. See CMake issue #20776.")
|
||||
endif()
|
||||
|
||||
set(clang_test_flags "--cuda-path=\"${CMAKE_CUDA_COMPILER_LIBRARY_ROOT}\"")
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
# Need to pass the host target and include directories if we're crosscompiling.
|
||||
string(APPEND clang_test_flags " --sysroot=\"${CMAKE_SYSROOT}\" --target=${CMAKE_CUDA_COMPILER_TARGET}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# First try with the user-specified architectures.
|
||||
if(CMAKE_CUDA_ARCHITECTURES)
|
||||
set(clang_archs "${clang_test_flags}")
|
||||
set(nvcc_archs "${nvcc_test_flags}")
|
||||
|
||||
foreach(arch ${CMAKE_CUDA_ARCHITECTURES})
|
||||
# Strip specifiers as PTX vs binary doesn't matter.
|
||||
string(REGEX MATCH "[0-9]+" arch_name "${arch}")
|
||||
string(APPEND clang_archs " --cuda-gpu-arch=sm_${arch_name}")
|
||||
string(APPEND nvcc_archs " -gencode=arch=compute_${arch_name},code=sm_${arch_name}")
|
||||
list(APPEND tested_architectures "${arch_name}")
|
||||
endforeach()
|
||||
|
||||
list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_archs}")
|
||||
list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${nvcc_archs}")
|
||||
endif()
|
||||
|
||||
# Fallback default NVCC flags.
|
||||
list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST ${nvcc_test_flags})
|
||||
|
||||
# Clang doesn't automatically select an architecture supported by the SDK.
|
||||
# Try in reverse order of deprecation with the most recent at front (i.e. the most likely to work for new setups).
|
||||
foreach(arch "20" "30" "52")
|
||||
list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags} --cuda-gpu-arch=sm_${arch}")
|
||||
endforeach()
|
||||
|
||||
# Finally also try the default.
|
||||
list(APPEND CMAKE_CUDA_COMPILER_ID_TEST_FLAGS_FIRST "${clang_test_flags}")
|
||||
|
||||
# We perform compiler identification for a second time to extract implicit linking info and host compiler for NVCC.
|
||||
# We also use it to verify that CMAKE_CUDA_ARCHITECTURES and additionaly on Clang that CUDA toolkit path works.
|
||||
# The latter could be done during compiler testing in the future to avoid doing this for Clang.
|
||||
# We need to unset the compiler ID otherwise CMAKE_DETERMINE_COMPILER_ID() doesn't work.
|
||||
set(CMAKE_CUDA_COMPILER_ID)
|
||||
set(CMAKE_CUDA_PLATFORM_ID)
|
||||
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
|
||||
CMAKE_CUDA_COMPILER_ID_PLATFORM_CONTENT)
|
||||
|
||||
CMAKE_DETERMINE_COMPILER_ID(CUDA CUDAFLAGS CMakeCUDACompilerId.cu)
|
||||
|
||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
|
||||
# Now that we have the path to nvcc, we can compute the toolkit root.
|
||||
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_CUDA_COMPILER}" DIRECTORY)
|
||||
get_filename_component(CMAKE_CUDA_COMPILER_TOOLKIT_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}" DIRECTORY)
|
||||
set(CMAKE_CUDA_COMPILER_LIBRARY_ROOT "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}")
|
||||
endif()
|
||||
|
||||
_cmake_find_compiler_sysroot(CUDA)
|
||||
endif()
|
||||
|
||||
set(_CMAKE_PROCESSING_LANGUAGE "CUDA")
|
||||
include(CMakeFindBinUtils)
|
||||
include(Compiler/${CMAKE_CUDA_COMPILER_ID}-FindBinUtils OPTIONAL)
|
||||
unset(_CMAKE_PROCESSING_LANGUAGE)
|
||||
|
||||
if(MSVC_CUDA_ARCHITECTURE_ID)
|
||||
set(SET_MSVC_CUDA_ARCHITECTURE_ID
|
||||
"set(MSVC_CUDA_ARCHITECTURE_ID ${MSVC_CUDA_ARCHITECTURE_ID})")
|
||||
endif()
|
||||
|
||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
|
||||
set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${CMAKE_LINKER}")
|
||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "")
|
||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "")
|
||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
|
||||
|
||||
# We do not currently detect CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES but we
|
||||
# do need to detect CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT from the compiler by
|
||||
# looking at which cudart library exists in the implicit link libraries passed
|
||||
# to the host linker.
|
||||
if(CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT MATCHES "link\\.exe [^\n]*cudart_static\\.lib")
|
||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC")
|
||||
elseif(CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT MATCHES "link\\.exe [^\n]*cudart\\.lib")
|
||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "SHARED")
|
||||
else()
|
||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "NONE")
|
||||
endif()
|
||||
set(_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT
|
||||
"set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT \"${CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT}\")")
|
||||
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
|
||||
if(NOT CMAKE_CUDA_ARCHITECTURES)
|
||||
# Find the architecture that we successfully compiled using and set it as the default.
|
||||
string(REGEX MATCH "-target-cpu sm_([0-9]+)" dont_care "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
|
||||
set(detected_architecture "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
string(REGEX MATCHALL "-target-cpu sm_([0-9]+)" target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
|
||||
|
||||
foreach(cpu ${target_cpus})
|
||||
string(REGEX MATCH "-target-cpu sm_([0-9]+)" dont_care "${cpu}")
|
||||
list(APPEND architectures "${CMAKE_MATCH_1}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Find target directory. Account for crosscompiling.
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a")
|
||||
# Support for NVPACK
|
||||
set(_CUDA_TARGET_NAME "armv7-linux-androideabi")
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
|
||||
set(_CUDA_TARGET_NAME "armv7-linux-gnueabihf")
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
|
||||
if(ANDROID_ARCH_NAME STREQUAL "arm64")
|
||||
set(_CUDA_TARGET_NAME "aarch64-linux-androideabi")
|
||||
else()
|
||||
set(_CUDA_TARGET_NAME "aarch64-linux")
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
set(_CUDA_TARGET_NAME "x86_64-linux")
|
||||
endif()
|
||||
|
||||
if(EXISTS "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/targets/${_CUDA_TARGET_NAME}")
|
||||
set(_CUDA_TARGET_DIR "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}/targets/${_CUDA_TARGET_NAME}")
|
||||
endif()
|
||||
else()
|
||||
set(_CUDA_TARGET_DIR "${CMAKE_CUDA_COMPILER_TOOLKIT_ROOT}")
|
||||
endif()
|
||||
|
||||
# We can't use find_library() yet at this point, so try a few guesses.
|
||||
if(EXISTS "${_CUDA_TARGET_DIR}/lib64")
|
||||
set(_CUDA_LIBRARY_DIR "${_CUDA_TARGET_DIR}/lib64")
|
||||
elseif(EXISTS "${_CUDA_TARGET_DIR}/lib/x64")
|
||||
set(_CUDA_LIBRARY_DIR "${_CUDA_TARGET_DIR}/lib/x64")
|
||||
elseif(EXISTS "${_CUDA_TARGET_DIR}/lib")
|
||||
set(_CUDA_LIBRARY_DIR "${_CUDA_TARGET_DIR}/lib")
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to find _CUDA_LIBRARY_DIR based on _CUDA_TARGET_DIR=${_CUDA_TARGET_DIR}")
|
||||
endif()
|
||||
|
||||
# _CUDA_TARGET_DIR always points to the directory containing the include directory.
|
||||
# On a scattered installation /usr, on a non-scattered something like /usr/local/cuda or /usr/local/cuda-10.2/targets/aarch64-linux.
|
||||
if(EXISTS "${_CUDA_TARGET_DIR}/include/cuda_runtime.h")
|
||||
set(_CUDA_INCLUDE_DIR "${_CUDA_TARGET_DIR}/include")
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to find cuda_runtime.h in \"${_CUDA_TARGET_DIR}/include\" for _CUDA_INCLUDE_DIR.")
|
||||
endif()
|
||||
|
||||
# Clang does not add any CUDA SDK libraries or directories when invoking the host linker.
|
||||
# Add the CUDA toolkit library directory ourselves so that linking works.
|
||||
# The CUDA runtime libraries are handled elsewhere by CMAKE_CUDA_RUNTIME_LIBRARY.
|
||||
set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "${_CUDA_INCLUDE_DIR}")
|
||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "${_CUDA_LIBRARY_DIR}")
|
||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "")
|
||||
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
|
||||
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
|
||||
set(_nvcc_log "")
|
||||
string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
|
||||
if(_nvcc_output_orig MATCHES "#\\\$ +PATH= *([^\n]*)\n")
|
||||
set(_nvcc_path "${CMAKE_MATCH_1}")
|
||||
string(APPEND _nvcc_log " found 'PATH=' string: [${_nvcc_path}]\n")
|
||||
string(REPLACE ":" ";" _nvcc_path "${_nvcc_path}")
|
||||
else()
|
||||
set(_nvcc_path "")
|
||||
string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
|
||||
string(APPEND _nvcc_log " no 'PATH=' string found in nvcc output:${_nvcc_output_log}\n")
|
||||
endif()
|
||||
if(_nvcc_output_orig MATCHES "#\\\$ +LIBRARIES= *([^\n]*)\n")
|
||||
set(_nvcc_libraries "${CMAKE_MATCH_1}")
|
||||
string(APPEND _nvcc_log " found 'LIBRARIES=' string: [${_nvcc_libraries}]\n")
|
||||
else()
|
||||
set(_nvcc_libraries "")
|
||||
string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
|
||||
string(APPEND _nvcc_log " no 'LIBRARIES=' string found in nvcc output:${_nvcc_output_log}\n")
|
||||
endif()
|
||||
|
||||
set(_nvcc_link_line "")
|
||||
if(_nvcc_libraries)
|
||||
# Remove variable assignments.
|
||||
string(REGEX REPLACE "#\\\$ *[^= ]+=[^\n]*\n" "" _nvcc_output "${_nvcc_output_orig}")
|
||||
# Encode [] characters that break list expansion.
|
||||
string(REPLACE "[" "{==={" _nvcc_output "${_nvcc_output}")
|
||||
string(REPLACE "]" "}===}" _nvcc_output "${_nvcc_output}")
|
||||
# Split lines.
|
||||
string(REGEX REPLACE "\n+(#\\\$ )?" ";" _nvcc_output "${_nvcc_output}")
|
||||
foreach(line IN LISTS _nvcc_output)
|
||||
set(_nvcc_output_line "${line}")
|
||||
string(REPLACE "{==={" "[" _nvcc_output_line "${_nvcc_output_line}")
|
||||
string(REPLACE "}===}" "]" _nvcc_output_line "${_nvcc_output_line}")
|
||||
string(APPEND _nvcc_log " considering line: [${_nvcc_output_line}]\n")
|
||||
if("${_nvcc_output_line}" MATCHES "^ *nvlink")
|
||||
string(APPEND _nvcc_log " ignoring nvlink line\n")
|
||||
elseif(_nvcc_libraries)
|
||||
if("${_nvcc_output_line}" MATCHES "(@\"?tmp/a\\.exe\\.res\"?)")
|
||||
set(_nvcc_link_res_arg "${CMAKE_MATCH_1}")
|
||||
set(_nvcc_link_res "${CMAKE_PLATFORM_INFO_DIR}/CompilerIdCUDA/tmp/a.exe.res")
|
||||
if(EXISTS "${_nvcc_link_res}")
|
||||
file(READ "${_nvcc_link_res}" _nvcc_link_res_content)
|
||||
string(REPLACE "${_nvcc_link_res_arg}" "${_nvcc_link_res_content}" _nvcc_output_line "${_nvcc_output_line}")
|
||||
endif()
|
||||
endif()
|
||||
string(FIND "${_nvcc_output_line}" "${_nvcc_libraries}" _nvcc_libraries_pos)
|
||||
if(NOT _nvcc_libraries_pos EQUAL -1)
|
||||
set(_nvcc_link_line "${_nvcc_output_line}")
|
||||
string(APPEND _nvcc_log " extracted link line: [${_nvcc_link_line}]\n")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(_nvcc_link_line)
|
||||
if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${CMAKE_LINKER}")
|
||||
else()
|
||||
#extract the compiler that is being used for linking
|
||||
separate_arguments(_nvcc_link_line_args UNIX_COMMAND "${_nvcc_link_line}")
|
||||
list(GET _nvcc_link_line_args 0 _nvcc_host_link_launcher)
|
||||
if(IS_ABSOLUTE "${_nvcc_host_link_launcher}")
|
||||
string(APPEND _nvcc_log " extracted link launcher absolute path: [${_nvcc_host_link_launcher}]\n")
|
||||
set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${_nvcc_host_link_launcher}")
|
||||
else()
|
||||
string(APPEND _nvcc_log " extracted link launcher name: [${_nvcc_host_link_launcher}]\n")
|
||||
find_program(_nvcc_find_host_link_launcher
|
||||
NAMES ${_nvcc_host_link_launcher}
|
||||
PATHS ${_nvcc_path} NO_DEFAULT_PATH)
|
||||
find_program(_nvcc_find_host_link_launcher
|
||||
NAMES ${_nvcc_host_link_launcher})
|
||||
if(_nvcc_find_host_link_launcher)
|
||||
string(APPEND _nvcc_log " found link launcher absolute path: [${_nvcc_find_host_link_launcher}]\n")
|
||||
set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${_nvcc_find_host_link_launcher}")
|
||||
else()
|
||||
string(APPEND _nvcc_log " could not find link launcher absolute path\n")
|
||||
set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${_nvcc_host_link_launcher}")
|
||||
endif()
|
||||
unset(_nvcc_find_host_link_launcher CACHE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#prefix the line with cuda-fake-ld so that implicit link info believes it is
|
||||
#a link line
|
||||
set(_nvcc_link_line "cuda-fake-ld ${_nvcc_link_line}")
|
||||
CMAKE_PARSE_IMPLICIT_LINK_INFO("${_nvcc_link_line}"
|
||||
CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES
|
||||
CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES
|
||||
CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
|
||||
log
|
||||
"${CMAKE_CUDA_IMPLICIT_OBJECT_REGEX}")
|
||||
|
||||
# Detect CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT from the compiler by looking at which
|
||||
# cudart library exists in the implicit link libraries passed to the host linker.
|
||||
# This is required when a project sets the cuda runtime library as part of the
|
||||
# initial flags.
|
||||
if(";${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES};" MATCHES [[;cudart_static(\.lib)?;]])
|
||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC")
|
||||
elseif(";${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES};" MATCHES [[;cudart(\.lib)?;]])
|
||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "SHARED")
|
||||
else()
|
||||
set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "NONE")
|
||||
endif()
|
||||
set(_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT
|
||||
"set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT \"${CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT}\")")
|
||||
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Parsed CUDA nvcc implicit link information from above output:\n${_nvcc_log}\n${log}\n\n")
|
||||
else()
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Failed to parse CUDA nvcc implicit link information:\n${_nvcc_log}\n\n")
|
||||
message(FATAL_ERROR "Failed to extract nvcc implicit link line.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES is detected above as the list of
|
||||
# libraries that the CUDA compiler implicitly passes to the host linker.
|
||||
# CMake invokes the host linker directly and so needs to pass these libraries.
|
||||
# We filter out those that should not be passed unconditionally both here
|
||||
# and from CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES in CMakeTestCUDACompiler.
|
||||
set(CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES_EXCLUDE
|
||||
# The CUDA runtime libraries are controlled by CMAKE_CUDA_RUNTIME_LIBRARY.
|
||||
cudart cudart.lib
|
||||
cudart_static cudart_static.lib
|
||||
cudadevrt cudadevrt.lib
|
||||
|
||||
# Dependencies of the CUDA static runtime library on Linux hosts.
|
||||
rt
|
||||
pthread
|
||||
dl
|
||||
)
|
||||
list(REMOVE_ITEM CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES ${CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES_EXCLUDE})
|
||||
|
||||
if(CMAKE_CUDA_COMPILER_SYSROOT)
|
||||
string(CONCAT _SET_CMAKE_CUDA_COMPILER_SYSROOT
|
||||
"set(CMAKE_CUDA_COMPILER_SYSROOT \"${CMAKE_CUDA_COMPILER_SYSROOT}\")\n"
|
||||
"set(CMAKE_COMPILER_SYSROOT \"${CMAKE_CUDA_COMPILER_SYSROOT}\")")
|
||||
else()
|
||||
set(_SET_CMAKE_CUDA_COMPILER_SYSROOT "")
|
||||
endif()
|
||||
|
||||
# Determine CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
|
||||
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
|
||||
set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES)
|
||||
string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
|
||||
if(_nvcc_output_orig MATCHES "#\\\$ +INCLUDES= *([^\n]*)\n")
|
||||
set(_nvcc_includes "${CMAKE_MATCH_1}")
|
||||
string(APPEND _nvcc_log " found 'INCLUDES=' string: [${_nvcc_includes}]\n")
|
||||
else()
|
||||
set(_nvcc_includes "")
|
||||
string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
|
||||
string(APPEND _nvcc_log " no 'INCLUDES=' string found in nvcc output:${_nvcc_output_log}\n")
|
||||
endif()
|
||||
if(_nvcc_includes)
|
||||
# across all operating system each include directory is prefixed with -I
|
||||
separate_arguments(_nvcc_output NATIVE_COMMAND "${_nvcc_includes}")
|
||||
foreach(line IN LISTS _nvcc_output)
|
||||
string(REGEX REPLACE "^-I" "" line "${line}")
|
||||
get_filename_component(line "${line}" ABSOLUTE)
|
||||
list(APPEND CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "${line}")
|
||||
endforeach()
|
||||
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Parsed CUDA nvcc include information from above output:\n${_nvcc_log}\n${log}\n\n")
|
||||
else()
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Failed to detect CUDA nvcc include information:\n${_nvcc_log}\n\n")
|
||||
endif()
|
||||
|
||||
# Parse default CUDA architecture.
|
||||
cmake_policy(GET CMP0104 _CUDA_CMP0104)
|
||||
if(NOT CMAKE_CUDA_ARCHITECTURES AND _CUDA_CMP0104 STREQUAL "NEW")
|
||||
string(REGEX MATCH "arch[ =]compute_([0-9]+)" dont_care "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
|
||||
set(detected_architecture "${CMAKE_MATCH_1}")
|
||||
elseif(CMAKE_CUDA_ARCHITECTURES)
|
||||
string(REGEX MATCHALL "-arch compute_([0-9]+)" target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
|
||||
|
||||
foreach(cpu ${target_cpus})
|
||||
string(REGEX MATCH "-arch compute_([0-9]+)" dont_care "${cpu}")
|
||||
list(APPEND architectures "${CMAKE_MATCH_1}")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If the user didn't set the architectures, then set them to a default.
|
||||
# If the user did, then make sure those architectures worked.
|
||||
if(DEFINED detected_architecture AND "${CMAKE_CUDA_ARCHITECTURES}" STREQUAL "")
|
||||
set(CMAKE_CUDA_ARCHITECTURES "${detected_architecture}" CACHE STRING "CUDA architectures")
|
||||
|
||||
if(NOT CMAKE_CUDA_ARCHITECTURES)
|
||||
message(FATAL_ERROR "Failed to find a working CUDA architecture.")
|
||||
endif()
|
||||
elseif(architectures)
|
||||
# Sort since order mustn't matter.
|
||||
list(SORT architectures)
|
||||
list(SORT tested_architectures)
|
||||
|
||||
# We don't distinguish real/virtual architectures during testing.
|
||||
# For "70-real;70-virtual" we detect "70" as working and tested_architectures is "70;70".
|
||||
# Thus we need to remove duplicates before checking if they're equal.
|
||||
list(REMOVE_DUPLICATES tested_architectures)
|
||||
|
||||
if(NOT "${architectures}" STREQUAL "${tested_architectures}")
|
||||
message(FATAL_ERROR
|
||||
"The CMAKE_CUDA_ARCHITECTURES:\n"
|
||||
" ${CMAKE_CUDA_ARCHITECTURES}\n"
|
||||
"do not all work with this compiler. Try:\n"
|
||||
" ${architectures}\n"
|
||||
"instead.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# configure all variables set in this file
|
||||
configure_file(${CMAKE_ROOT}/Modules/CMakeCUDACompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeCUDACompiler.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
# Don't leak variables unnecessarily to user code.
|
||||
unset(_CUDA_INCLUDE_DIR CACHE)
|
||||
unset(_CUDA_NVCC_EXECUTABLE CACHE)
|
||||
unset(_CUDA_LIBRARY_DIR)
|
||||
unset(_CUDA_TARGET_DIR)
|
||||
unset(_CUDA_TARGET_NAME)
|
||||
|
||||
set(CMAKE_CUDA_COMPILER_ENV_VAR "CUDACXX")
|
||||
set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX")
|
|
@ -0,0 +1,225 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# determine the compiler to use for C++ programs
|
||||
# NOTE, a generator may set CMAKE_CXX_COMPILER before
|
||||
# loading this file to force a compiler.
|
||||
# use environment variable CXX first if defined by user, next use
|
||||
# the cmake variable CMAKE_GENERATOR_CXX which can be defined by a generator
|
||||
# as a default compiler
|
||||
# If the internal cmake variable _CMAKE_TOOLCHAIN_PREFIX is set, this is used
|
||||
# as prefix for the tools (e.g. arm-elf-g++, arm-elf-ar etc.)
|
||||
#
|
||||
# Sets the following variables:
|
||||
# CMAKE_CXX_COMPILER
|
||||
# CMAKE_COMPILER_IS_GNUCXX
|
||||
# CMAKE_AR
|
||||
# CMAKE_RANLIB
|
||||
#
|
||||
# If not already set before, it also sets
|
||||
# _CMAKE_TOOLCHAIN_PREFIX
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
|
||||
|
||||
# Load system-specific compiler preferences for this language.
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-Determine-CXX OPTIONAL)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-CXX OPTIONAL)
|
||||
if(NOT CMAKE_CXX_COMPILER_NAMES)
|
||||
set(CMAKE_CXX_COMPILER_NAMES CC)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
|
||||
elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
|
||||
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
|
||||
set(CMAKE_CXX_COMPILER_XCODE_TYPE sourcecode.cpp.cpp)
|
||||
_cmake_find_compiler_path(CXX)
|
||||
else()
|
||||
if(NOT CMAKE_CXX_COMPILER)
|
||||
set(CMAKE_CXX_COMPILER_INIT NOTFOUND)
|
||||
|
||||
# prefer the environment variable CXX
|
||||
if(NOT $ENV{CXX} STREQUAL "")
|
||||
get_filename_component(CMAKE_CXX_COMPILER_INIT $ENV{CXX} PROGRAM PROGRAM_ARGS CMAKE_CXX_FLAGS_ENV_INIT)
|
||||
if(CMAKE_CXX_FLAGS_ENV_INIT)
|
||||
set(CMAKE_CXX_COMPILER_ARG1 "${CMAKE_CXX_FLAGS_ENV_INIT}" CACHE STRING "First argument to CXX compiler")
|
||||
endif()
|
||||
if(NOT EXISTS ${CMAKE_CXX_COMPILER_INIT})
|
||||
message(FATAL_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}.\n${CMAKE_CXX_COMPILER_INIT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# next prefer the generator specified compiler
|
||||
if(CMAKE_GENERATOR_CXX)
|
||||
if(NOT CMAKE_CXX_COMPILER_INIT)
|
||||
set(CMAKE_CXX_COMPILER_INIT ${CMAKE_GENERATOR_CXX})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# finally list compilers to try
|
||||
if(NOT CMAKE_CXX_COMPILER_INIT)
|
||||
set(CMAKE_CXX_COMPILER_LIST CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC clang++)
|
||||
endif()
|
||||
|
||||
_cmake_find_compiler(CXX)
|
||||
else()
|
||||
_cmake_find_compiler_path(CXX)
|
||||
endif()
|
||||
mark_as_advanced(CMAKE_CXX_COMPILER)
|
||||
|
||||
# Each entry in this list is a set of extra flags to try
|
||||
# adding to the compile line to see if it helps produce
|
||||
# a valid identification file.
|
||||
set(CMAKE_CXX_COMPILER_ID_TEST_FLAGS_FIRST)
|
||||
set(CMAKE_CXX_COMPILER_ID_TEST_FLAGS
|
||||
# Try compiling to an object file only.
|
||||
"-c"
|
||||
# IAR does not detect language automatically
|
||||
"--c++"
|
||||
"--ec++"
|
||||
|
||||
# ARMClang need target options
|
||||
"--target=arm-arm-none-eabi -mcpu=cortex-m3"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Build a small source file to identify the compiler.
|
||||
if(NOT CMAKE_CXX_COMPILER_ID_RUN)
|
||||
set(CMAKE_CXX_COMPILER_ID_RUN 1)
|
||||
|
||||
# Try to identify the compiler.
|
||||
set(CMAKE_CXX_COMPILER_ID)
|
||||
set(CMAKE_CXX_PLATFORM_ID)
|
||||
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
|
||||
CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT)
|
||||
|
||||
# The IAR compiler produces weird output.
|
||||
# See https://gitlab.kitware.com/cmake/cmake/-/issues/10176#note_153591
|
||||
list(APPEND CMAKE_CXX_COMPILER_ID_VENDORS IAR)
|
||||
set(CMAKE_CXX_COMPILER_ID_VENDOR_FLAGS_IAR )
|
||||
set(CMAKE_CXX_COMPILER_ID_VENDOR_REGEX_IAR "IAR .+ Compiler")
|
||||
|
||||
# Match the link line from xcodebuild output of the form
|
||||
# Ld ...
|
||||
# ...
|
||||
# /path/to/cc ...CompilerIdCXX/...
|
||||
# to extract the compiler front-end for the language.
|
||||
set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdCXX/(\\./)?(CompilerIdCXX.(framework|xctest)/)?CompilerIdCXX[ \t\n\\\"]")
|
||||
set(CMAKE_CXX_COMPILER_ID_TOOL_MATCH_INDEX 2)
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
|
||||
CMAKE_DETERMINE_COMPILER_ID(CXX CXXFLAGS CMakeCXXCompilerId.cpp)
|
||||
|
||||
_cmake_find_compiler_sysroot(CXX)
|
||||
|
||||
# Set old compiler and platform id variables.
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_COMPILER_IS_GNUCXX 1)
|
||||
endif()
|
||||
if(CMAKE_CXX_PLATFORM_ID MATCHES "MinGW")
|
||||
set(CMAKE_COMPILER_IS_MINGW 1)
|
||||
elseif(CMAKE_CXX_PLATFORM_ID MATCHES "Cygwin")
|
||||
set(CMAKE_COMPILER_IS_CYGWIN 1)
|
||||
endif()
|
||||
else()
|
||||
if(NOT DEFINED CMAKE_CXX_COMPILER_FRONTEND_VARIANT)
|
||||
# Some toolchain files set our internal CMAKE_CXX_COMPILER_ID_RUN
|
||||
# variable but are not aware of CMAKE_CXX_COMPILER_FRONTEND_VARIANT.
|
||||
# They pre-date our support for the GNU-like variant targeting the
|
||||
# MSVC ABI so we do not consider that here.
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "MSVC")
|
||||
else()
|
||||
set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "GNU")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
||||
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH)
|
||||
endif ()
|
||||
|
||||
# if we have a g++ cross compiler, they have usually some prefix, like
|
||||
# e.g. powerpc-linux-g++, arm-elf-g++ or i586-mingw32msvc-g++ , optionally
|
||||
# with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2).
|
||||
# The other tools of the toolchain usually have the same prefix
|
||||
# NAME_WE cannot be used since then this test will fail for names like
|
||||
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
|
||||
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
|
||||
|
||||
|
||||
if (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]+)*)?(-[^.]+)?(\\.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}-)
|
||||
endif()
|
||||
elseif(COMPILER_BASENAME MATCHES "QCC(\\.exe)?$")
|
||||
if(CMAKE_CXX_COMPILER_TARGET MATCHES "gcc_nto([a-z0-9]+_[0-9]+|[^_le]+)(le)")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
|
||||
# but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
|
||||
if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||
endif ()
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "TI")
|
||||
# TI compilers are named e.g. cl6x, cl470 or armcl.exe
|
||||
get_filename_component(COMPILER_BASENAME "${CMAKE_CXX_COMPILER}" NAME)
|
||||
if (COMPILER_BASENAME MATCHES "^(.+)?cl([^.]+)?(\\.exe)?$")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX "${CMAKE_MATCH_1}")
|
||||
set(_CMAKE_TOOLCHAIN_SUFFIX "${CMAKE_MATCH_2}")
|
||||
endif ()
|
||||
|
||||
endif()
|
||||
|
||||
endif ()
|
||||
|
||||
set(_CMAKE_PROCESSING_LANGUAGE "CXX")
|
||||
include(CMakeFindBinUtils)
|
||||
include(Compiler/${CMAKE_CXX_COMPILER_ID}-FindBinUtils OPTIONAL)
|
||||
unset(_CMAKE_PROCESSING_LANGUAGE)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_SYSROOT)
|
||||
string(CONCAT _SET_CMAKE_CXX_COMPILER_SYSROOT
|
||||
"set(CMAKE_CXX_COMPILER_SYSROOT \"${CMAKE_CXX_COMPILER_SYSROOT}\")\n"
|
||||
"set(CMAKE_COMPILER_SYSROOT \"${CMAKE_CXX_COMPILER_SYSROOT}\")")
|
||||
else()
|
||||
set(_SET_CMAKE_CXX_COMPILER_SYSROOT "")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID)
|
||||
set(_SET_CMAKE_CXX_COMPILER_ARCHITECTURE_ID
|
||||
"set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID})")
|
||||
else()
|
||||
set(_SET_CMAKE_CXX_COMPILER_ARCHITECTURE_ID "")
|
||||
endif()
|
||||
|
||||
if(MSVC_CXX_ARCHITECTURE_ID)
|
||||
set(SET_MSVC_CXX_ARCHITECTURE_ID
|
||||
"set(MSVC_CXX_ARCHITECTURE_ID ${MSVC_CXX_ARCHITECTURE_ID})")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_XCODE_ARCHS)
|
||||
set(SET_CMAKE_XCODE_ARCHS
|
||||
"set(CMAKE_XCODE_ARCHS \"${CMAKE_CXX_XCODE_ARCHS}\")")
|
||||
endif()
|
||||
|
||||
# configure all variables set in this file
|
||||
configure_file(${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
|
|
@ -0,0 +1,147 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
function(cmake_determine_compile_features lang)
|
||||
|
||||
if(lang STREQUAL C AND COMMAND cmake_record_c_compile_features)
|
||||
message(CHECK_START "Detecting ${lang} compile features")
|
||||
|
||||
set(CMAKE_C90_COMPILE_FEATURES)
|
||||
set(CMAKE_C99_COMPILE_FEATURES)
|
||||
set(CMAKE_C11_COMPILE_FEATURES)
|
||||
|
||||
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
|
||||
|
||||
cmake_record_c_compile_features()
|
||||
|
||||
if(NOT _result EQUAL 0)
|
||||
message(CHECK_FAIL "failed")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (CMAKE_C99_COMPILE_FEATURES AND CMAKE_C11_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_C11_COMPILE_FEATURES ${CMAKE_C99_COMPILE_FEATURES})
|
||||
endif()
|
||||
if (CMAKE_C90_COMPILE_FEATURES AND CMAKE_C99_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_C99_COMPILE_FEATURES ${CMAKE_C90_COMPILE_FEATURES})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_C_COMPILE_FEATURES)
|
||||
set(CMAKE_C_COMPILE_FEATURES
|
||||
${CMAKE_C90_COMPILE_FEATURES}
|
||||
${CMAKE_C99_COMPILE_FEATURES}
|
||||
${CMAKE_C11_COMPILE_FEATURES}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_COMPILE_FEATURES ${CMAKE_C_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_C90_COMPILE_FEATURES ${CMAKE_C90_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_C99_COMPILE_FEATURES ${CMAKE_C99_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_C11_COMPILE_FEATURES ${CMAKE_C11_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
|
||||
message(CHECK_PASS "done")
|
||||
|
||||
elseif(lang STREQUAL CXX AND COMMAND cmake_record_cxx_compile_features)
|
||||
message(CHECK_START "Detecting ${lang} compile features")
|
||||
|
||||
set(CMAKE_CXX98_COMPILE_FEATURES)
|
||||
set(CMAKE_CXX11_COMPILE_FEATURES)
|
||||
set(CMAKE_CXX14_COMPILE_FEATURES)
|
||||
set(CMAKE_CXX17_COMPILE_FEATURES)
|
||||
set(CMAKE_CXX20_COMPILE_FEATURES)
|
||||
|
||||
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
|
||||
|
||||
cmake_record_cxx_compile_features()
|
||||
|
||||
if(NOT _result EQUAL 0)
|
||||
message(CHECK_FAIL "failed")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX17_COMPILE_FEATURES AND CMAKE_CXX20_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_CXX20_COMPILE_FEATURES ${CMAKE_CXX17_COMPILE_FEATURES})
|
||||
endif()
|
||||
if (CMAKE_CXX14_COMPILE_FEATURES AND CMAKE_CXX17_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_CXX17_COMPILE_FEATURES ${CMAKE_CXX14_COMPILE_FEATURES})
|
||||
endif()
|
||||
if (CMAKE_CXX11_COMPILE_FEATURES AND CMAKE_CXX14_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES})
|
||||
endif()
|
||||
if (CMAKE_CXX98_COMPILE_FEATURES AND CMAKE_CXX11_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILE_FEATURES)
|
||||
set(CMAKE_CXX_COMPILE_FEATURES
|
||||
${CMAKE_CXX98_COMPILE_FEATURES}
|
||||
${CMAKE_CXX11_COMPILE_FEATURES}
|
||||
${CMAKE_CXX14_COMPILE_FEATURES}
|
||||
${CMAKE_CXX17_COMPILE_FEATURES}
|
||||
${CMAKE_CXX20_COMPILE_FEATURES}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_COMPILE_FEATURES ${CMAKE_CXX_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_CXX98_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_CXX14_COMPILE_FEATURES ${CMAKE_CXX14_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_CXX17_COMPILE_FEATURES ${CMAKE_CXX17_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_CXX20_COMPILE_FEATURES ${CMAKE_CXX20_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
|
||||
message(CHECK_PASS "done")
|
||||
|
||||
elseif(lang STREQUAL CUDA AND COMMAND cmake_record_cuda_compile_features)
|
||||
message(CHECK_START "Detecting ${lang} compile features")
|
||||
|
||||
set(CMAKE_CUDA03_COMPILE_FEATURES)
|
||||
set(CMAKE_CUDA11_COMPILE_FEATURES)
|
||||
set(CMAKE_CUDA14_COMPILE_FEATURES)
|
||||
set(CMAKE_CUDA17_COMPILE_FEATURES)
|
||||
set(CMAKE_CUDA20_COMPILE_FEATURES)
|
||||
|
||||
include("${CMAKE_ROOT}/Modules/Internal/FeatureTesting.cmake")
|
||||
|
||||
cmake_record_cuda_compile_features()
|
||||
|
||||
if(NOT _result EQUAL 0)
|
||||
message(CHECK_FAIL "failed")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (CMAKE_CUDA17_COMPILE_FEATURES AND CMAKE_CUDA20_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_CUDA20_COMPILE_FEATURES ${CMAKE_CUDA17_COMPILE_FEATURES})
|
||||
endif()
|
||||
if (CMAKE_CUDA14_COMPILE_FEATURES AND CMAKE_CUDA17_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_CUDA17_COMPILE_FEATURES ${CMAKE_CUDA14_COMPILE_FEATURES})
|
||||
endif()
|
||||
if (CMAKE_CUDA11_COMPILE_FEATURES AND CMAKE_CUDA14_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_CUDA14_COMPILE_FEATURES ${CMAKE_CUDA11_COMPILE_FEATURES})
|
||||
endif()
|
||||
if (CMAKE_CUDA03_COMPILE_FEATURES AND CMAKE_CUDA11_COMPILE_FEATURES)
|
||||
list(REMOVE_ITEM CMAKE_CUDA11_COMPILE_FEATURES ${CMAKE_CUDA03_COMPILE_FEATURES})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CUDA_COMPILE_FEATURES)
|
||||
set(CMAKE_CUDA_COMPILE_FEATURES
|
||||
${CMAKE_CUDA03_COMPILE_FEATURES}
|
||||
${CMAKE_CUDA11_COMPILE_FEATURES}
|
||||
${CMAKE_CUDA14_COMPILE_FEATURES}
|
||||
${CMAKE_CUDA17_COMPILE_FEATURES}
|
||||
${CMAKE_CUDA20_COMPILE_FEATURES}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CUDA_COMPILE_FEATURES ${CMAKE_CUDA_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_CUDA03_COMPILE_FEATURES ${CMAKE_CUDA03_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_CUDA11_COMPILE_FEATURES ${CMAKE_CUDA11_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_CUDA14_COMPILE_FEATURES ${CMAKE_CUDA14_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_CUDA17_COMPILE_FEATURES ${CMAKE_CUDA17_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
set(CMAKE_CUDA20_COMPILE_FEATURES ${CMAKE_CUDA20_COMPILE_FEATURES} PARENT_SCOPE)
|
||||
|
||||
message(CHECK_PASS "done")
|
||||
|
||||
endif()
|
||||
|
||||
endfunction()
|
|
@ -0,0 +1,152 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
macro(_cmake_find_compiler lang)
|
||||
# Use already-enabled languages for reference.
|
||||
get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
list(REMOVE_ITEM _languages "${lang}")
|
||||
|
||||
if(CMAKE_${lang}_COMPILER_INIT)
|
||||
# Search only for the specified compiler.
|
||||
set(CMAKE_${lang}_COMPILER_LIST "${CMAKE_${lang}_COMPILER_INIT}")
|
||||
else()
|
||||
# Re-order the compiler list with preferred vendors first.
|
||||
set(_${lang}_COMPILER_LIST "${CMAKE_${lang}_COMPILER_LIST}")
|
||||
set(CMAKE_${lang}_COMPILER_LIST "")
|
||||
# Prefer vendors of compilers from reference languages.
|
||||
foreach(l ${_languages})
|
||||
list(APPEND CMAKE_${lang}_COMPILER_LIST
|
||||
${_${lang}_COMPILER_NAMES_${CMAKE_${l}_COMPILER_ID}})
|
||||
endforeach()
|
||||
# Prefer vendors based on the platform.
|
||||
list(APPEND CMAKE_${lang}_COMPILER_LIST ${CMAKE_${lang}_COMPILER_NAMES})
|
||||
# Append the rest of the list and remove duplicates.
|
||||
list(APPEND CMAKE_${lang}_COMPILER_LIST ${_${lang}_COMPILER_LIST})
|
||||
unset(_${lang}_COMPILER_LIST)
|
||||
list(REMOVE_DUPLICATES CMAKE_${lang}_COMPILER_LIST)
|
||||
if(CMAKE_${lang}_COMPILER_EXCLUDE)
|
||||
list(REMOVE_ITEM CMAKE_${lang}_COMPILER_LIST
|
||||
${CMAKE_${lang}_COMPILER_EXCLUDE})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Look for directories containing compilers of reference languages.
|
||||
set(_${lang}_COMPILER_HINTS)
|
||||
foreach(l ${_languages})
|
||||
if(CMAKE_${l}_COMPILER AND IS_ABSOLUTE "${CMAKE_${l}_COMPILER}")
|
||||
get_filename_component(_hint "${CMAKE_${l}_COMPILER}" PATH)
|
||||
if(IS_DIRECTORY "${_hint}")
|
||||
list(APPEND _${lang}_COMPILER_HINTS "${_hint}")
|
||||
endif()
|
||||
unset(_hint)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Find the compiler.
|
||||
if(_${lang}_COMPILER_HINTS)
|
||||
# Prefer directories containing compilers of reference languages.
|
||||
list(REMOVE_DUPLICATES _${lang}_COMPILER_HINTS)
|
||||
find_program(CMAKE_${lang}_COMPILER
|
||||
NAMES ${CMAKE_${lang}_COMPILER_LIST}
|
||||
PATHS ${_${lang}_COMPILER_HINTS}
|
||||
NO_DEFAULT_PATH
|
||||
DOC "${lang} compiler")
|
||||
endif()
|
||||
if(CMAKE_HOST_WIN32 AND CMAKE_GENERATOR MATCHES "Ninja")
|
||||
# On Windows command-line builds, the Makefile generators each imply
|
||||
# a preferred compiler tool. The Ninja generator does not imply a
|
||||
# compiler tool, so use the compiler that occurs first in PATH.
|
||||
find_program(CMAKE_${lang}_COMPILER
|
||||
NAMES ${CMAKE_${lang}_COMPILER_LIST}
|
||||
NAMES_PER_DIR
|
||||
DOC "${lang} compiler"
|
||||
NO_PACKAGE_ROOT_PATH
|
||||
NO_CMAKE_PATH
|
||||
NO_CMAKE_ENVIRONMENT_PATH
|
||||
NO_CMAKE_SYSTEM_PATH
|
||||
)
|
||||
endif()
|
||||
find_program(CMAKE_${lang}_COMPILER NAMES ${CMAKE_${lang}_COMPILER_LIST} DOC "${lang} compiler")
|
||||
if(CMAKE_${lang}_COMPILER_INIT AND NOT CMAKE_${lang}_COMPILER)
|
||||
set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${CMAKE_${lang}_COMPILER_INIT}")
|
||||
endif()
|
||||
unset(_${lang}_COMPILER_HINTS)
|
||||
unset(_languages)
|
||||
|
||||
# Look for a make tool provided by Xcode
|
||||
if(CMAKE_HOST_APPLE)
|
||||
macro(_query_xcrun compiler_name result_var_keyword result_var)
|
||||
if(NOT "x${result_var_keyword}" STREQUAL "xRESULT_VAR")
|
||||
message(FATAL_ERROR "Bad arguments to macro")
|
||||
endif()
|
||||
execute_process(COMMAND xcrun --find ${compiler_name}
|
||||
OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_VARIABLE _xcrun_err)
|
||||
set("${result_var}" "${_xcrun_out}")
|
||||
endmacro()
|
||||
|
||||
set(xcrun_result)
|
||||
if (CMAKE_${lang}_COMPILER MATCHES "^/usr/bin/(.+)$")
|
||||
_query_xcrun("${CMAKE_MATCH_1}" RESULT_VAR xcrun_result)
|
||||
elseif (CMAKE_${lang}_COMPILER STREQUAL "CMAKE_${lang}_COMPILER-NOTFOUND")
|
||||
foreach(comp ${CMAKE_${lang}_COMPILER_LIST})
|
||||
_query_xcrun("${comp}" RESULT_VAR xcrun_result)
|
||||
if(xcrun_result)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
if (xcrun_result)
|
||||
set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${xcrun_result}")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(_cmake_find_compiler_path lang)
|
||||
if(CMAKE_${lang}_COMPILER)
|
||||
# we only get here if CMAKE_${lang}_COMPILER was specified using -D or a pre-made CMakeCache.txt
|
||||
# (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
|
||||
# if CMAKE_${lang}_COMPILER is a list of length 2, use the first item as
|
||||
# CMAKE_${lang}_COMPILER and the 2nd one as CMAKE_${lang}_COMPILER_ARG1
|
||||
list(LENGTH CMAKE_${lang}_COMPILER _CMAKE_${lang}_COMPILER_LIST_LENGTH)
|
||||
if("${_CMAKE_${lang}_COMPILER_LIST_LENGTH}" EQUAL 2)
|
||||
list(GET CMAKE_${lang}_COMPILER 1 CMAKE_${lang}_COMPILER_ARG1)
|
||||
list(GET CMAKE_${lang}_COMPILER 0 CMAKE_${lang}_COMPILER)
|
||||
endif()
|
||||
unset(_CMAKE_${lang}_COMPILER_LIST_LENGTH)
|
||||
|
||||
# find the compiler in the PATH if necessary
|
||||
get_filename_component(_CMAKE_USER_${lang}_COMPILER_PATH "${CMAKE_${lang}_COMPILER}" PATH)
|
||||
if(NOT _CMAKE_USER_${lang}_COMPILER_PATH)
|
||||
find_program(CMAKE_${lang}_COMPILER_WITH_PATH NAMES ${CMAKE_${lang}_COMPILER})
|
||||
if(CMAKE_${lang}_COMPILER_WITH_PATH)
|
||||
set(CMAKE_${lang}_COMPILER ${CMAKE_${lang}_COMPILER_WITH_PATH})
|
||||
get_property(_CMAKE_${lang}_COMPILER_CACHED CACHE CMAKE_${lang}_COMPILER PROPERTY TYPE)
|
||||
if(_CMAKE_${lang}_COMPILER_CACHED)
|
||||
set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER}" CACHE STRING "${lang} compiler" FORCE)
|
||||
endif()
|
||||
unset(_CMAKE_${lang}_COMPILER_CACHED)
|
||||
endif()
|
||||
unset(CMAKE_${lang}_COMPILER_WITH_PATH CACHE)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
function(_cmake_find_compiler_sysroot lang)
|
||||
if(CMAKE_${lang}_COMPILER_ID STREQUAL "GNU")
|
||||
execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" -print-sysroot
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
OUTPUT_VARIABLE _cmake_sysroot_run_out
|
||||
ERROR_VARIABLE _cmake_sysroot_run_err)
|
||||
|
||||
if(_cmake_sysroot_run_out AND NOT _cmake_sysroot_run_err
|
||||
AND NOT _cmake_sysroot_run_out STREQUAL "/"
|
||||
AND IS_DIRECTORY "${_cmake_sysroot_run_out}/usr")
|
||||
file(TO_CMAKE_PATH "${_cmake_sysroot_run_out}/usr" _cmake_sysroot_run_out_usr)
|
||||
set(CMAKE_${lang}_COMPILER_SYSROOT "${_cmake_sysroot_run_out_usr}" PARENT_SCOPE)
|
||||
else()
|
||||
set(CMAKE_${lang}_COMPILER_SYSROOT "" PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
|
@ -0,0 +1,190 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# Function to compile a source file to identify the compiler ABI.
|
||||
# This is used internally by CMake and should not be included by user
|
||||
# code.
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitIncludeInfo.cmake)
|
||||
include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake)
|
||||
include(CMakeTestCompilerCommon)
|
||||
|
||||
function(CMAKE_DETERMINE_COMPILER_ABI lang src)
|
||||
if(NOT DEFINED CMAKE_${lang}_ABI_COMPILED)
|
||||
message(CHECK_START "Detecting ${lang} compiler ABI info")
|
||||
|
||||
# Compile the ABI identification source.
|
||||
set(BIN "${CMAKE_PLATFORM_INFO_DIR}/CMakeDetermineCompilerABI_${lang}.bin")
|
||||
set(CMAKE_FLAGS )
|
||||
set(COMPILE_DEFINITIONS )
|
||||
if(DEFINED CMAKE_${lang}_VERBOSE_FLAG)
|
||||
set(CMAKE_FLAGS "-DEXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
|
||||
set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_FLAG}")
|
||||
endif()
|
||||
if(DEFINED CMAKE_${lang}_VERBOSE_COMPILE_FLAG)
|
||||
set(COMPILE_DEFINITIONS "${CMAKE_${lang}_VERBOSE_COMPILE_FLAG}")
|
||||
endif()
|
||||
if(NOT "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC")
|
||||
# Avoid adding our own platform standard libraries for compilers
|
||||
# from which we might detect implicit link libraries.
|
||||
list(APPEND CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD_LIBRARIES=")
|
||||
endif()
|
||||
__TestCompiler_setTryCompileTargetType()
|
||||
|
||||
# Avoid failing ABI detection on warnings.
|
||||
string(REGEX REPLACE "(^| )-Werror(=[^ ]*)?( |$)" " " CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}")
|
||||
|
||||
# Save the current LC_ALL, LC_MESSAGES, and LANG environment variables
|
||||
# and set them to "C" that way GCC's "search starts here" text is in
|
||||
# English and we can grok it.
|
||||
set(_orig_lc_all $ENV{LC_ALL})
|
||||
set(_orig_lc_messages $ENV{LC_MESSAGES})
|
||||
set(_orig_lang $ENV{LANG})
|
||||
set(ENV{LC_ALL} C)
|
||||
set(ENV{LC_MESSAGES} C)
|
||||
set(ENV{LANG} C)
|
||||
|
||||
try_compile(CMAKE_${lang}_ABI_COMPILED
|
||||
${CMAKE_BINARY_DIR} ${src}
|
||||
CMAKE_FLAGS ${CMAKE_FLAGS}
|
||||
# Ignore unused flags when we are just determining the ABI.
|
||||
"--no-warn-unused-cli"
|
||||
COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS}
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
COPY_FILE "${BIN}"
|
||||
COPY_FILE_ERROR _copy_error
|
||||
__CMAKE_INTERNAL ABI
|
||||
)
|
||||
|
||||
# Restore original LC_ALL, LC_MESSAGES, and LANG
|
||||
set(ENV{LC_ALL} ${_orig_lc_all})
|
||||
set(ENV{LC_MESSAGES} ${_orig_lc_messages})
|
||||
set(ENV{LANG} ${_orig_lang})
|
||||
|
||||
# Move result from cache to normal variable.
|
||||
set(CMAKE_${lang}_ABI_COMPILED ${CMAKE_${lang}_ABI_COMPILED})
|
||||
unset(CMAKE_${lang}_ABI_COMPILED CACHE)
|
||||
if(CMAKE_${lang}_ABI_COMPILED AND _copy_error)
|
||||
set(CMAKE_${lang}_ABI_COMPILED 0)
|
||||
endif()
|
||||
set(CMAKE_${lang}_ABI_COMPILED ${CMAKE_${lang}_ABI_COMPILED} PARENT_SCOPE)
|
||||
|
||||
# Load the resulting information strings.
|
||||
if(CMAKE_${lang}_ABI_COMPILED)
|
||||
message(CHECK_PASS "done")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Detecting ${lang} compiler ABI info compiled with the following output:\n${OUTPUT}\n\n")
|
||||
file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
|
||||
foreach(info ${ABI_STRINGS})
|
||||
if("${info}" MATCHES "INFO:sizeof_dptr\\[0*([^]]*)\\]")
|
||||
set(ABI_SIZEOF_DPTR "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
if("${info}" MATCHES "INFO:abi\\[([^]]*)\\]")
|
||||
set(ABI_NAME "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(ABI_SIZEOF_DPTR)
|
||||
set(CMAKE_${lang}_SIZEOF_DATA_PTR "${ABI_SIZEOF_DPTR}" PARENT_SCOPE)
|
||||
elseif(CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT)
|
||||
set(CMAKE_${lang}_SIZEOF_DATA_PTR "${CMAKE_${lang}_SIZEOF_DATA_PTR_DEFAULT}" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
if(ABI_NAME)
|
||||
set(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
# Parse implicit include directory for this language, if available.
|
||||
if(CMAKE_${lang}_VERBOSE_FLAG)
|
||||
set (implicit_incdirs "")
|
||||
cmake_parse_implicit_include_info("${OUTPUT}" "${lang}"
|
||||
implicit_incdirs log rv)
|
||||
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()
|
||||
endif()
|
||||
set(CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES "${_CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT}" PARENT_SCOPE)
|
||||
|
||||
# Parse implicit linker information for this language, if available.
|
||||
set(implicit_dirs "")
|
||||
set(implicit_libs "")
|
||||
set(implicit_fwks "")
|
||||
if(CMAKE_${lang}_VERBOSE_FLAG)
|
||||
CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs implicit_fwks log
|
||||
"${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Parsed ${lang} implicit link information from above output:\n${log}\n\n")
|
||||
endif()
|
||||
# for VS IDE Intel Fortran we have to figure out the
|
||||
# implicit link path for the fortran run time using
|
||||
# a try-compile
|
||||
if("${lang}" MATCHES "Fortran"
|
||||
AND "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
||||
message(CHECK_START "Determine Intel Fortran Compiler Implicit Link Path")
|
||||
# Build a sample project which reports symbols.
|
||||
try_compile(IFORT_LIB_PATH_COMPILED
|
||||
${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath
|
||||
${CMAKE_ROOT}/Modules/IntelVSImplicitPath
|
||||
IntelFortranImplicit
|
||||
CMAKE_FLAGS
|
||||
"-DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}"
|
||||
OUTPUT_VARIABLE _output)
|
||||
file(WRITE
|
||||
"${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.txt"
|
||||
"${_output}")
|
||||
include(${CMAKE_BINARY_DIR}/CMakeFiles/IntelVSImplicitPath/output.cmake OPTIONAL)
|
||||
message(CHECK_PASS "done")
|
||||
endif()
|
||||
|
||||
# Implicit link libraries cannot be used explicitly for multiple
|
||||
# OS X architectures, so we skip it.
|
||||
if(DEFINED CMAKE_OSX_ARCHITECTURES)
|
||||
if("${CMAKE_OSX_ARCHITECTURES}" MATCHES ";")
|
||||
set(implicit_libs "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${implicit_fwks}" PARENT_SCOPE)
|
||||
|
||||
# Detect library architecture directory name.
|
||||
if(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
|
||||
foreach(dir ${implicit_dirs})
|
||||
if("${dir}" MATCHES "/lib/${CMAKE_LIBRARY_ARCHITECTURE_REGEX}$")
|
||||
get_filename_component(arch "${dir}" NAME)
|
||||
set(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${arch}" PARENT_SCOPE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL QCC)
|
||||
foreach(dir ${implicit_dirs})
|
||||
if (dir MATCHES "/lib$")
|
||||
get_filename_component(assumedArchDir "${dir}" DIRECTORY)
|
||||
get_filename_component(archParentDir "${assumedArchDir}" DIRECTORY)
|
||||
if (archParentDir STREQUAL CMAKE_SYSROOT)
|
||||
get_filename_component(archDirName "${assumedArchDir}" NAME)
|
||||
set(CMAKE_${lang}_LIBRARY_ARCHITECTURE "${archDirName}" PARENT_SCOPE)
|
||||
break()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
else()
|
||||
message(CHECK_FAIL "failed")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Detecting ${lang} compiler ABI info failed to compile with the following output:\n${OUTPUT}\n${_copy_error}\n\n")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
|
@ -0,0 +1,956 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# Function to compile a source file to identify the compiler. This is
|
||||
# used internally by CMake and should not be included by user code.
|
||||
# If successful, sets CMAKE_<lang>_COMPILER_ID and CMAKE_<lang>_PLATFORM_ID
|
||||
|
||||
function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
|
||||
# Make sure the compiler arguments are clean.
|
||||
string(STRIP "${CMAKE_${lang}_COMPILER_ARG1}" CMAKE_${lang}_COMPILER_ID_ARG1)
|
||||
string(REGEX REPLACE " +" ";" CMAKE_${lang}_COMPILER_ID_ARG1 "${CMAKE_${lang}_COMPILER_ID_ARG1}")
|
||||
|
||||
# Make sure user-specified compiler flags are used.
|
||||
if(CMAKE_${lang}_FLAGS)
|
||||
set(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS})
|
||||
else()
|
||||
set(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${flagvar}})
|
||||
endif()
|
||||
string(REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}")
|
||||
|
||||
# Compute the directory in which to run the test.
|
||||
set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang})
|
||||
|
||||
# Try building with no extra flags and then try each set
|
||||
# of helper flags. Stop when the compiler is identified.
|
||||
foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
|
||||
foreach(testflags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}
|
||||
""
|
||||
${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
|
||||
separate_arguments(testflags UNIX_COMMAND "${testflags}")
|
||||
CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${testflags}" "${userflags}" "${src}")
|
||||
CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR("${lang}" "${COMPILER_${lang}_PRODUCED_OUTPUT}")
|
||||
if(CMAKE_${lang}_COMPILER_ID)
|
||||
break()
|
||||
endif()
|
||||
foreach(file ${COMPILER_${lang}_PRODUCED_FILES})
|
||||
CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
|
||||
endforeach()
|
||||
if(CMAKE_${lang}_COMPILER_ID)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
if(CMAKE_${lang}_COMPILER_ID)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Check if compiler id detection gave us the compiler tool.
|
||||
if(CMAKE_${lang}_COMPILER_ID_TOOL)
|
||||
set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_ID_TOOL}")
|
||||
set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_ID_TOOL}" PARENT_SCOPE)
|
||||
elseif(NOT CMAKE_${lang}_COMPILER)
|
||||
set(CMAKE_${lang}_COMPILER "CMAKE_${lang}_COMPILER-NOTFOUND" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
# If the compiler is still unknown, try to query its vendor.
|
||||
if(CMAKE_${lang}_COMPILER AND NOT CMAKE_${lang}_COMPILER_ID)
|
||||
foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
|
||||
CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang} "${userflags}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# If the compiler is still unknown, fallback to GHS
|
||||
if(NOT CMAKE_${lang}_COMPILER_ID AND "${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
|
||||
set(CMAKE_${lang}_COMPILER_ID GHS)
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"The ${lang} compiler identification is falling back to GHS.\n\n")
|
||||
endif()
|
||||
|
||||
# CUDA < 7.5 is missing version macros
|
||||
if(lang STREQUAL "CUDA"
|
||||
AND CMAKE_${lang}_COMPILER_ID STREQUAL "NVIDIA"
|
||||
AND NOT CMAKE_${lang}_COMPILER_VERSION)
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_${lang}_COMPILER}"
|
||||
--version
|
||||
OUTPUT_VARIABLE output ERROR_VARIABLE output
|
||||
RESULT_VARIABLE result
|
||||
TIMEOUT 10
|
||||
)
|
||||
if(output MATCHES [=[ V([0-9]+)\.([0-9]+)\.([0-9]+)]=])
|
||||
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# For Swift we need to explicitly query the version.
|
||||
if(lang STREQUAL "Swift"
|
||||
AND CMAKE_${lang}_COMPILER
|
||||
AND NOT CMAKE_${lang}_COMPILER_VERSION)
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_${lang}_COMPILER}"
|
||||
-version
|
||||
OUTPUT_VARIABLE output ERROR_VARIABLE output
|
||||
RESULT_VARIABLE result
|
||||
TIMEOUT 10
|
||||
)
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Running the ${lang} compiler: \"${CMAKE_${lang}_COMPILER}\" -version\n"
|
||||
"${output}\n"
|
||||
)
|
||||
|
||||
if(output MATCHES [[Swift version ([0-9]+\.[0-9]+(\.[0-9]+)?)]])
|
||||
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_MATCH_1}")
|
||||
if(NOT CMAKE_${lang}_COMPILER_ID)
|
||||
set(CMAKE_Swift_COMPILER_ID "Apple")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (COMPILER_QNXNTO AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU")
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_${lang}_COMPILER}"
|
||||
-V
|
||||
OUTPUT_VARIABLE output ERROR_VARIABLE output
|
||||
RESULT_VARIABLE result
|
||||
TIMEOUT 10
|
||||
)
|
||||
if (output MATCHES "targets available")
|
||||
set(CMAKE_${lang}_COMPILER_ID QCC)
|
||||
# http://community.qnx.com/sf/discussion/do/listPosts/projects.community/discussion.qnx_momentics_community_support.topc3555?_pagenum=2
|
||||
# The qcc driver does not itself have a version.
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# if the format is unknown after all files have been checked, put "Unknown" in the cache
|
||||
if(NOT CMAKE_EXECUTABLE_FORMAT)
|
||||
set(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format")
|
||||
endif()
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "^Ninja" AND MSVC_${lang}_ARCHITECTURE_ID)
|
||||
foreach(userflags "${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}" "")
|
||||
CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX(${lang} "${userflags}")
|
||||
endforeach()
|
||||
else()
|
||||
set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "")
|
||||
endif()
|
||||
|
||||
set(_variant "")
|
||||
if("x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xClang")
|
||||
if("x${CMAKE_${lang}_SIMULATE_ID}" STREQUAL "xMSVC")
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "MSVC")
|
||||
else()
|
||||
# Test whether an MSVC-like command-line option works.
|
||||
execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" -?
|
||||
RESULT_VARIABLE _clang_result
|
||||
OUTPUT_VARIABLE _clang_stdout
|
||||
ERROR_VARIABLE _clang_stderr)
|
||||
if(_clang_result EQUAL 0)
|
||||
set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "MSVC")
|
||||
else()
|
||||
set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "GNU")
|
||||
endif()
|
||||
endif()
|
||||
set(_variant " with ${CMAKE_${lang}_COMPILER_FRONTEND_VARIANT}-like command-line")
|
||||
else()
|
||||
set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "GNU")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "")
|
||||
endif()
|
||||
|
||||
# Display the final identification result.
|
||||
if(CMAKE_${lang}_COMPILER_ID)
|
||||
if(CMAKE_${lang}_COMPILER_VERSION)
|
||||
set(_version " ${CMAKE_${lang}_COMPILER_VERSION}")
|
||||
else()
|
||||
set(_version "")
|
||||
endif()
|
||||
if(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID AND "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xIAR")
|
||||
set(_archid " ${CMAKE_${lang}_COMPILER_ARCHITECTURE_ID}")
|
||||
else()
|
||||
set(_archid "")
|
||||
endif()
|
||||
message(STATUS "The ${lang} compiler identification is "
|
||||
"${CMAKE_${lang}_COMPILER_ID}${_archid}${_version}${_variant}")
|
||||
unset(_archid)
|
||||
unset(_version)
|
||||
unset(_variant)
|
||||
else()
|
||||
message(STATUS "The ${lang} compiler identification is unknown")
|
||||
endif()
|
||||
|
||||
if(lang STREQUAL "Fortran" AND CMAKE_${lang}_COMPILER_ID STREQUAL "XL")
|
||||
set(CMAKE_${lang}_XL_CPP "${CMAKE_${lang}_COMPILER_ID_CPP}" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "${CMAKE_${lang}_COMPILER_ARCHITECTURE_ID}" PARENT_SCOPE)
|
||||
set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
|
||||
PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_XCODE_ARCHS "${CMAKE_${lang}_XCODE_ARCHS}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT "${CMAKE_${lang}_COMPILER_FRONTEND_VARIANT}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_VERSION_INTERNAL "${CMAKE_${lang}_COMPILER_VERSION_INTERNAL}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_WRAPPER "${CMAKE_${lang}_COMPILER_WRAPPER}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_PRODUCED_OUTPUT "${COMPILER_${lang}_PRODUCED_OUTPUT}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
include(CMakeCompilerIdDetection)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Function to write the compiler id source file.
|
||||
function(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src)
|
||||
find_file(src_in ${src}.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
||||
file(READ ${src_in} ID_CONTENT_IN)
|
||||
|
||||
compiler_id_detection(CMAKE_${lang}_COMPILER_ID_CONTENT ${lang}
|
||||
ID_STRING
|
||||
VERSION_STRINGS
|
||||
PLATFORM_DEFAULT_COMPILER
|
||||
)
|
||||
|
||||
unset(src_in CACHE)
|
||||
string(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY)
|
||||
file(WRITE ${CMAKE_${lang}_COMPILER_ID_DIR}/${src} "${ID_CONTENT_OUT}")
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Function to build the compiler id source file and look for output
|
||||
# files.
|
||||
function(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags userflags src)
|
||||
# Create a clean working directory.
|
||||
file(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||
file(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||
file(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}/tmp)
|
||||
CMAKE_DETERMINE_COMPILER_ID_WRITE("${lang}" "${src}")
|
||||
|
||||
# Construct a description of this test case.
|
||||
set(COMPILER_DESCRIPTION
|
||||
"Compiler: ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_ARG1}
|
||||
Build flags: ${userflags}
|
||||
Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
|
||||
")
|
||||
|
||||
# Compile the compiler identification source.
|
||||
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)")
|
||||
set(vs_version ${CMAKE_MATCH_1})
|
||||
set(id_platform ${CMAKE_VS_PLATFORM_NAME})
|
||||
set(id_lang "${lang}")
|
||||
set(id_PostBuildEvent_Command "")
|
||||
if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Ll][Ll][Vv][Mm](_v[0-9]+(_xp)?)?$")
|
||||
set(id_cl_var "ClangClExecutable")
|
||||
elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "^[Cc][Ll][Aa][Nn][Gg][Cc][Ll]$")
|
||||
set(id_cl "$(CLToolExe)")
|
||||
elseif(CMAKE_VS_PLATFORM_TOOLSET MATCHES "v[0-9]+_clang_.*")
|
||||
set(id_cl clang.exe)
|
||||
else()
|
||||
set(id_cl cl.exe)
|
||||
endif()
|
||||
if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
|
||||
set(v NsightTegra)
|
||||
set(ext vcxproj)
|
||||
if(lang STREQUAL CXX)
|
||||
set(id_gcc g++)
|
||||
set(id_clang clang++)
|
||||
else()
|
||||
set(id_gcc gcc)
|
||||
set(id_clang clang)
|
||||
endif()
|
||||
elseif(lang STREQUAL Fortran)
|
||||
set(v Intel)
|
||||
set(ext vfproj)
|
||||
set(id_cl ifort.exe)
|
||||
elseif(lang STREQUAL CSharp)
|
||||
set(v 10)
|
||||
set(ext csproj)
|
||||
set(id_cl csc.exe)
|
||||
elseif(NOT "${vs_version}" VERSION_LESS 10)
|
||||
set(v 10)
|
||||
set(ext vcxproj)
|
||||
else()
|
||||
set(id_version ${vs_version}.00)
|
||||
set(v 7)
|
||||
set(ext vcproj)
|
||||
endif()
|
||||
if(CMAKE_VS_PLATFORM_TOOLSET)
|
||||
if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
|
||||
set(id_toolset "<NdkToolchainVersion>${CMAKE_VS_PLATFORM_TOOLSET}</NdkToolchainVersion>")
|
||||
else()
|
||||
set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>")
|
||||
if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel")
|
||||
set(id_cl icl.exe)
|
||||
endif()
|
||||
if(CMAKE_VS_PLATFORM_TOOLSET_VERSION)
|
||||
set(id_sep "\\")
|
||||
if(CMAKE_VS_PLATFORM_TOOLSET_VERSION VERSION_GREATER_EQUAL "14.20")
|
||||
if(EXISTS "${CMAKE_GENERATOR_INSTANCE}/VC/Auxiliary/Build.${CMAKE_VS_PLATFORM_TOOLSET_VERSION}/Microsoft.VCToolsVersion.${CMAKE_VS_PLATFORM_TOOLSET_VERSION}.props")
|
||||
set(id_sep ".")
|
||||
endif()
|
||||
endif()
|
||||
set(id_toolset_version_props "<Import Project=\"${CMAKE_GENERATOR_INSTANCE}\\VC\\Auxiliary\\Build${id_sep}${CMAKE_VS_PLATFORM_TOOLSET_VERSION}\\Microsoft.VCToolsVersion.${CMAKE_VS_PLATFORM_TOOLSET_VERSION}.props\" />")
|
||||
unset(id_sep)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(id_toolset "")
|
||||
set(id_toolset_version_props "")
|
||||
endif()
|
||||
if(CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE)
|
||||
set(id_PreferredToolArchitecture "<PreferredToolArchitecture>${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}</PreferredToolArchitecture>")
|
||||
else()
|
||||
set(id_PreferredToolArchitecture "")
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
|
||||
set(id_system "<ApplicationType>Windows Phone</ApplicationType>")
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
set(id_system "<ApplicationType>Windows Store</ApplicationType>")
|
||||
else()
|
||||
set(id_system "")
|
||||
endif()
|
||||
if(id_system AND CMAKE_SYSTEM_VERSION MATCHES "^([0-9]+\\.[0-9]+)")
|
||||
set(id_system_version "<ApplicationTypeRevision>${CMAKE_MATCH_1}</ApplicationTypeRevision>")
|
||||
else()
|
||||
set(id_system_version "")
|
||||
endif()
|
||||
if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION)
|
||||
set(id_WindowsTargetPlatformVersion "<WindowsTargetPlatformVersion>${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}</WindowsTargetPlatformVersion>")
|
||||
endif()
|
||||
if(CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR)
|
||||
set(id_ToolsetVCTargetsDir "<VCTargetsPath>${CMAKE_VS_PLATFORM_TOOLSET_VCTARGETS_CUSTOM_DIR}</VCTargetsPath>")
|
||||
endif()
|
||||
set(id_CustomGlobals "")
|
||||
foreach(pair IN LISTS CMAKE_VS_GLOBALS)
|
||||
if("${pair}" MATCHES "([^=]+)=(.*)$")
|
||||
string(APPEND id_CustomGlobals "<${CMAKE_MATCH_1}>${CMAKE_MATCH_2}</${CMAKE_MATCH_1}>\n ")
|
||||
endif()
|
||||
endforeach()
|
||||
if(id_platform STREQUAL ARM64)
|
||||
set(id_WindowsSDKDesktopARMSupport "<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>")
|
||||
elseif(id_platform STREQUAL ARM)
|
||||
set(id_WindowsSDKDesktopARMSupport "<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>")
|
||||
else()
|
||||
set(id_WindowsSDKDesktopARMSupport "")
|
||||
endif()
|
||||
if(CMAKE_VS_WINCE_VERSION)
|
||||
set(id_entrypoint "mainACRTStartup")
|
||||
if("${vs_version}" VERSION_LESS 9)
|
||||
set(id_subsystem 9)
|
||||
else()
|
||||
set(id_subsystem 8)
|
||||
endif()
|
||||
else()
|
||||
set(id_subsystem 1)
|
||||
endif()
|
||||
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||
set(id_src "${src}")
|
||||
set(id_compile "ClCompile")
|
||||
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 "")
|
||||
set(id_Link_AdditionalDependencies "")
|
||||
if(lang STREQUAL CUDA)
|
||||
if(NOT CMAKE_VS_PLATFORM_TOOLSET_CUDA)
|
||||
message(FATAL_ERROR "No CUDA toolset found.")
|
||||
endif()
|
||||
set(cuda_tools "CUDA ${CMAKE_VS_PLATFORM_TOOLSET_CUDA}")
|
||||
set(id_compile "CudaCompile")
|
||||
set(id_ItemDefinitionGroup_entry "<CudaCompile><AdditionalOptions>%(AdditionalOptions)-v</AdditionalOptions></CudaCompile>")
|
||||
set(id_PostBuildEvent_Command [[echo CMAKE_CUDA_COMPILER=$(CudaToolkitBinDir)\nvcc.exe]])
|
||||
if(CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR)
|
||||
set(id_CudaToolkitCustomDir "<CudaToolkitCustomDir>${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}nvcc</CudaToolkitCustomDir>")
|
||||
string(CONCAT id_Import_props "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}\\CUDAVisualStudioIntegration\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.props\" />")
|
||||
string(CONCAT id_Import_targets "<Import Project=\"${CMAKE_VS_PLATFORM_TOOLSET_CUDA_CUSTOM_DIR}\\CUDAVisualStudioIntegration\\extras\\visual_studio_integration\\MSBuildExtensions\\${cuda_tools}.targets\" />")
|
||||
else()
|
||||
string(CONCAT id_Import_props [[<Import Project="$(VCTargetsPath)\BuildCustomizations\]] "${cuda_tools}" [[.props" />]])
|
||||
string(CONCAT id_Import_targets [[<Import Project="$(VCTargetsPath)\BuildCustomizations\]] "${cuda_tools}" [[.targets" />]])
|
||||
endif()
|
||||
if(CMAKE_VS_PLATFORM_NAME STREQUAL x64)
|
||||
set(id_ItemDefinitionGroup_entry "<CudaCompile><TargetMachinePlatform>64</TargetMachinePlatform><AdditionalOptions>%(AdditionalOptions)-v</AdditionalOptions></CudaCompile>")
|
||||
endif()
|
||||
if(CMAKE_CUDA_FLAGS MATCHES "(^| )-cudart +shared( |$)")
|
||||
set(id_Link_AdditionalDependencies "<AdditionalDependencies>cudart.lib</AdditionalDependencies>")
|
||||
else()
|
||||
set(id_Link_AdditionalDependencies "<AdditionalDependencies>cudart_static.lib</AdditionalDependencies>")
|
||||
endif()
|
||||
endif()
|
||||
configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
|
||||
${id_dir}/CompilerId${lang}.${ext} @ONLY)
|
||||
if(CMAKE_VS_MSBUILD_COMMAND AND NOT lang STREQUAL "Fortran")
|
||||
set(command "${CMAKE_VS_MSBUILD_COMMAND}" "CompilerId${lang}.${ext}"
|
||||
"/p:Configuration=Debug" "/p:Platform=${id_platform}" "/p:VisualStudioVersion=${vs_version}.0"
|
||||
)
|
||||
elseif(CMAKE_VS_DEVENV_COMMAND)
|
||||
set(command "${CMAKE_VS_DEVENV_COMMAND}" "CompilerId${lang}.${ext}" "/build" "Debug")
|
||||
else()
|
||||
set(command "")
|
||||
endif()
|
||||
if(command)
|
||||
execute_process(
|
||||
COMMAND ${command}
|
||||
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
|
||||
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
||||
ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
||||
RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
|
||||
)
|
||||
else()
|
||||
set(CMAKE_${lang}_COMPILER_ID_RESULT 1)
|
||||
set(CMAKE_${lang}_COMPILER_ID_OUTPUT "VS environment not known to support ${lang}")
|
||||
endif()
|
||||
# Match the compiler location line printed out.
|
||||
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CMAKE_${lang}_COMPILER=([^%\r\n]+)[\r\n]")
|
||||
# Strip VS diagnostic output from the end of the line.
|
||||
string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _comp "${CMAKE_MATCH_1}")
|
||||
if(EXISTS "${_comp}")
|
||||
file(TO_CMAKE_PATH "${_comp}" _comp)
|
||||
set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
|
||||
set(id_lang "${lang}")
|
||||
set(id_type ${CMAKE_${lang}_COMPILER_XCODE_TYPE})
|
||||
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||
set(id_src "${src}")
|
||||
if(CMAKE_XCODE_PLATFORM_TOOLSET)
|
||||
set(id_toolset "GCC_VERSION = ${CMAKE_XCODE_PLATFORM_TOOLSET};")
|
||||
else()
|
||||
set(id_toolset "")
|
||||
endif()
|
||||
if("${lang}" STREQUAL "Swift")
|
||||
if(CMAKE_Swift_LANGUAGE_VERSION)
|
||||
set(id_lang_version "SWIFT_VERSION = ${CMAKE_Swift_LANGUAGE_VERSION};")
|
||||
elseif(XCODE_VERSION VERSION_GREATER_EQUAL 10.2)
|
||||
set(id_lang_version "SWIFT_VERSION = 4.0;")
|
||||
elseif(XCODE_VERSION VERSION_GREATER_EQUAL 8.3)
|
||||
set(id_lang_version "SWIFT_VERSION = 3.0;")
|
||||
else()
|
||||
set(id_lang_version "SWIFT_VERSION = 2.3;")
|
||||
endif()
|
||||
else()
|
||||
set(id_lang_version "")
|
||||
endif()
|
||||
if(CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
set(id_deployment_target
|
||||
"MACOSX_DEPLOYMENT_TARGET = \"${CMAKE_OSX_DEPLOYMENT_TARGET}\";")
|
||||
else()
|
||||
set(id_deployment_target "")
|
||||
endif()
|
||||
set(id_product_type "com.apple.product-type.tool")
|
||||
if(CMAKE_OSX_SYSROOT)
|
||||
set(id_sdkroot "SDKROOT = \"${CMAKE_OSX_SYSROOT}\";")
|
||||
if(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ii][Pp][Hh][Oo][Nn][Ee]" OR
|
||||
CMAKE_OSX_SYSROOT MATCHES "(^|/)[Aa][Pp][Pp][Ll][Ee][Tt][Vv]")
|
||||
set(id_product_type "com.apple.product-type.bundle.unit-test")
|
||||
elseif(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ww][Aa][Tt][Cc][Hh]")
|
||||
set(id_product_type "com.apple.product-type.framework")
|
||||
endif()
|
||||
else()
|
||||
set(id_sdkroot "")
|
||||
endif()
|
||||
set(id_clang_cxx_library "")
|
||||
set(stdlib_regex "(^| )(-stdlib=)([^ ]+)( |$)")
|
||||
string(REGEX MATCHALL "${stdlib_regex}" all_stdlib_matches "${CMAKE_CXX_FLAGS}")
|
||||
if(all_stdlib_matches)
|
||||
list(GET all_stdlib_matches "-1" last_stdlib_match)
|
||||
if(last_stdlib_match MATCHES "${stdlib_regex}")
|
||||
set(id_clang_cxx_library "CLANG_CXX_LIBRARY = \"${CMAKE_MATCH_3}\";")
|
||||
endif()
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_SYSROOT MATCHES "^$|[Mm][Aa][Cc][Oo][Ss]")
|
||||
# When targeting macOS, use only the host architecture.
|
||||
set(id_archs [[ARCHS = "$(NATIVE_ARCH_ACTUAL)";]])
|
||||
else()
|
||||
set(id_archs "")
|
||||
endif()
|
||||
configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in
|
||||
${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY)
|
||||
unset(_ENV_MACOSX_DEPLOYMENT_TARGET)
|
||||
if(DEFINED ENV{MACOSX_DEPLOYMENT_TARGET})
|
||||
set(_ENV_MACOSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}")
|
||||
set(ENV{MACOSX_DEPLOYMENT_TARGET} "")
|
||||
endif()
|
||||
execute_process(COMMAND xcodebuild
|
||||
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
|
||||
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
||||
ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
||||
RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
|
||||
)
|
||||
if(DEFINED _ENV_MACOSX_DEPLOYMENT_TARGET)
|
||||
set(ENV{MACOSX_DEPLOYMENT_TARGET} "${_ENV_MACOSX_DEPLOYMENT_TARGET}")
|
||||
endif()
|
||||
|
||||
if(DEFINED CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_REGEX)
|
||||
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "${CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_REGEX}")
|
||||
set(_comp "${CMAKE_MATCH_${CMAKE_${lang}_COMPILER_ID_TOOL_MATCH_INDEX}}")
|
||||
if(EXISTS "${_comp}")
|
||||
set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "ARCHS=([^%\r\n]+)[\r\n]")
|
||||
set(CMAKE_${lang}_XCODE_ARCHS "${CMAKE_MATCH_1}")
|
||||
separate_arguments(CMAKE_${lang}_XCODE_ARCHS)
|
||||
set(CMAKE_${lang}_XCODE_ARCHS "${CMAKE_${lang}_XCODE_ARCHS}" PARENT_SCOPE)
|
||||
endif()
|
||||
elseif("${CMAKE_GENERATOR}" MATCHES "Green Hills MULTI")
|
||||
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||
set(id_src "${src}")
|
||||
if (GHS_PRIMARY_TARGET)
|
||||
set(ghs_primary_target "${GHS_PRIMARY_TARGET}")
|
||||
else()
|
||||
set(ghs_primary_target "${CMAKE_GENERATOR_PLATFORM}_${GHS_TARGET_PLATFORM}.tgt")
|
||||
endif()
|
||||
if ("${GHS_TARGET_PLATFORM}" MATCHES "integrity")
|
||||
set(bsp_name "macro GHS_BSP=${GHS_BSP_NAME}")
|
||||
set(os_dir "macro GHS_OS=${GHS_OS_DIR}")
|
||||
endif()
|
||||
set(command "${CMAKE_MAKE_PROGRAM}" "-commands" "-top" "GHS_default.gpj")
|
||||
configure_file(${CMAKE_ROOT}/Modules/CompilerId/GHS_default.gpj.in
|
||||
${id_dir}/GHS_default.gpj @ONLY)
|
||||
configure_file(${CMAKE_ROOT}/Modules/CompilerId/GHS_lib.gpj.in
|
||||
${id_dir}/GHS_lib.gpj @ONLY)
|
||||
execute_process(COMMAND ${command}
|
||||
WORKING_DIRECTORY ${id_dir}
|
||||
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
||||
ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
||||
RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
|
||||
)
|
||||
# Match the compiler location line printed out.
|
||||
set(ghs_toolpath "${CMAKE_MAKE_PROGRAM}")
|
||||
if(CMAKE_HOST_UNIX)
|
||||
string(REPLACE "/gbuild" "/" ghs_toolpath ${ghs_toolpath})
|
||||
else()
|
||||
string(REPLACE "/gbuild.exe" "/" ghs_toolpath ${ghs_toolpath})
|
||||
string(REPLACE / "\\\\" ghs_toolpath ${ghs_toolpath})
|
||||
endif()
|
||||
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "(${ghs_toolpath}[^ ]*)")
|
||||
if(CMAKE_HOST_UNIX)
|
||||
set(_comp "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
set(_comp "${CMAKE_MATCH_1}.exe")
|
||||
endif()
|
||||
if(EXISTS "${_comp}")
|
||||
file(TO_CMAKE_PATH "${_comp}" _comp)
|
||||
set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_${lang}_COMPILER}"
|
||||
${CMAKE_${lang}_COMPILER_ID_ARG1}
|
||||
${userflags}
|
||||
${testflags}
|
||||
${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
|
||||
"${src}"
|
||||
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
|
||||
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
||||
ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
||||
RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
|
||||
)
|
||||
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "exec: [^\n]*\\((/[^,\n]*/cpp),CMakeFortranCompilerId.F")
|
||||
set(_cpp "${CMAKE_MATCH_1}")
|
||||
if(EXISTS "${_cpp}")
|
||||
set(CMAKE_${lang}_COMPILER_ID_CPP "${_cpp}" PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Check the result of compilation.
|
||||
if(CMAKE_${lang}_COMPILER_ID_RESULT
|
||||
# Intel Fortran warns and ignores preprocessor lines without /fpp
|
||||
OR CMAKE_${lang}_COMPILER_ID_OUTPUT MATCHES "Bad # preprocessor line"
|
||||
)
|
||||
# Compilation failed.
|
||||
set(MSG
|
||||
"Compiling the ${lang} compiler identification source file \"${src}\" failed.
|
||||
${COMPILER_DESCRIPTION}
|
||||
The output was:
|
||||
${CMAKE_${lang}_COMPILER_ID_RESULT}
|
||||
${CMAKE_${lang}_COMPILER_ID_OUTPUT}
|
||||
|
||||
")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "${MSG}")
|
||||
#if(NOT CMAKE_${lang}_COMPILER_ID_ALLOW_FAIL)
|
||||
# message(FATAL_ERROR "${MSG}")
|
||||
#endif()
|
||||
|
||||
# No output files should be inspected.
|
||||
set(COMPILER_${lang}_PRODUCED_FILES)
|
||||
set(COMPILER_${lang}_PRODUCED_OUTPUT)
|
||||
else()
|
||||
# Compilation succeeded.
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Compiling the ${lang} compiler identification source file \"${src}\" succeeded.
|
||||
${COMPILER_DESCRIPTION}
|
||||
The output was:
|
||||
${CMAKE_${lang}_COMPILER_ID_RESULT}
|
||||
${CMAKE_${lang}_COMPILER_ID_OUTPUT}
|
||||
|
||||
")
|
||||
|
||||
# Find the executable produced by the compiler, try all files in the
|
||||
# binary dir.
|
||||
string(REGEX REPLACE "([][])" "[\\1]" _glob_id_dir "${CMAKE_${lang}_COMPILER_ID_DIR}")
|
||||
file(GLOB files
|
||||
RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR}
|
||||
|
||||
# normal case
|
||||
${_glob_id_dir}/*
|
||||
|
||||
# com.apple.package-type.bundle.unit-test
|
||||
${_glob_id_dir}/*.xctest/*
|
||||
|
||||
# com.apple.product-type.framework
|
||||
${_glob_id_dir}/*.framework/*
|
||||
)
|
||||
list(REMOVE_ITEM files "${src}")
|
||||
set(COMPILER_${lang}_PRODUCED_FILES "")
|
||||
foreach(file ${files})
|
||||
if(NOT IS_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}/${file})
|
||||
list(APPEND COMPILER_${lang}_PRODUCED_FILES ${file})
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Compilation of the ${lang} compiler identification source \""
|
||||
"${src}\" produced \"${file}\"\n\n")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT COMPILER_${lang}_PRODUCED_FILES)
|
||||
# No executable was found.
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Compilation of the ${lang} compiler identification source \""
|
||||
"${src}\" did not produce an executable in \""
|
||||
"${CMAKE_${lang}_COMPILER_ID_DIR}\".\n\n")
|
||||
endif()
|
||||
|
||||
set(COMPILER_${lang}_PRODUCED_OUTPUT "${CMAKE_${lang}_COMPILER_ID_OUTPUT}")
|
||||
endif()
|
||||
|
||||
# Return the files produced by the compilation.
|
||||
set(COMPILER_${lang}_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE)
|
||||
set(COMPILER_${lang}_PRODUCED_OUTPUT "${COMPILER_${lang}_PRODUCED_OUTPUT}" PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Function to extract the compiler id from compiler output.
|
||||
function(CMAKE_DETERMINE_COMPILER_ID_MATCH_VENDOR lang output)
|
||||
foreach(vendor ${CMAKE_${lang}_COMPILER_ID_MATCH_VENDORS})
|
||||
if(output MATCHES "${CMAKE_${lang}_COMPILER_ID_MATCH_VENDOR_REGEX_${vendor}}")
|
||||
set(CMAKE_${lang}_COMPILER_ID "${vendor}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Function to extract the compiler id from an executable.
|
||||
function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
|
||||
# Look for a compiler id if not yet known.
|
||||
if(NOT CMAKE_${lang}_COMPILER_ID)
|
||||
# Read the compiler identification string from the executable file.
|
||||
set(COMPILER_ID)
|
||||
set(COMPILER_VERSION)
|
||||
set(COMPILER_VERSION_MAJOR 0)
|
||||
set(COMPILER_VERSION_MINOR 0)
|
||||
set(COMPILER_VERSION_PATCH 0)
|
||||
set(COMPILER_VERSION_TWEAK 0)
|
||||
set(COMPILER_VERSION_INTERNAL "")
|
||||
set(HAVE_COMPILER_VERSION_MAJOR 0)
|
||||
set(HAVE_COMPILER_VERSION_MINOR 0)
|
||||
set(HAVE_COMPILER_VERSION_PATCH 0)
|
||||
set(HAVE_COMPILER_VERSION_TWEAK 0)
|
||||
set(COMPILER_WRAPPER)
|
||||
set(DIGIT_VALUE_1 1)
|
||||
set(DIGIT_VALUE_2 10)
|
||||
set(DIGIT_VALUE_3 100)
|
||||
set(DIGIT_VALUE_4 1000)
|
||||
set(DIGIT_VALUE_5 10000)
|
||||
set(DIGIT_VALUE_6 100000)
|
||||
set(DIGIT_VALUE_7 1000000)
|
||||
set(DIGIT_VALUE_8 10000000)
|
||||
set(PLATFORM_ID)
|
||||
set(ARCHITECTURE_ID)
|
||||
set(SIMULATE_ID)
|
||||
set(SIMULATE_VERSION)
|
||||
foreach(encoding "" "ENCODING;UTF-16LE" "ENCODING;UTF-16BE")
|
||||
file(STRINGS "${file}" CMAKE_${lang}_COMPILER_ID_STRINGS
|
||||
LIMIT_COUNT 38 ${encoding}
|
||||
REGEX ".?I.?N.?F.?O.?:.?[A-Za-z0-9_]+\\[[^]]*\\]")
|
||||
if(NOT CMAKE_${lang}_COMPILER_ID_STRINGS STREQUAL "")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
set(COMPILER_ID_TWICE)
|
||||
# With the IAR Compiler, some strings are found twice, first time as incomplete
|
||||
# list like "?<Constant "INFO:compiler[IAR]">". Remove the incomplete copies.
|
||||
list(FILTER CMAKE_${lang}_COMPILER_ID_STRINGS EXCLUDE REGEX "\\?<Constant \\\"")
|
||||
# In C# binaries, some strings are found more than once.
|
||||
list(REMOVE_DUPLICATES CMAKE_${lang}_COMPILER_ID_STRINGS)
|
||||
foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
|
||||
# The IAR-AVR compiler uses a binary format that places a '6'
|
||||
# character (0x34) before each character in the string. Strip
|
||||
# out these characters without removing any legitamate characters.
|
||||
if("${info}" MATCHES "(.)I.N.F.O.:.")
|
||||
string(REGEX REPLACE "${CMAKE_MATCH_1}(.)" "\\1" info "${info}")
|
||||
endif()
|
||||
if("${info}" MATCHES "INFO:compiler\\[([^]\"]*)\\]")
|
||||
if(COMPILER_ID)
|
||||
set(COMPILER_ID_TWICE 1)
|
||||
endif()
|
||||
set(COMPILER_ID "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
if("${info}" MATCHES "INFO:platform\\[([^]\"]*)\\]")
|
||||
set(PLATFORM_ID "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
if("${info}" MATCHES "INFO:arch\\[([^]\"]*)\\]")
|
||||
set(ARCHITECTURE_ID "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
if("${info}" MATCHES "INFO:compiler_version\\[([^]\"]*)\\]")
|
||||
string(REGEX REPLACE "^0+([0-9]+)" "\\1" COMPILER_VERSION "${CMAKE_MATCH_1}")
|
||||
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}")
|
||||
endif()
|
||||
if("${info}" MATCHES "INFO:compiler_version_internal\\[([^]\"]*)\\]")
|
||||
string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION_INTERNAL "${CMAKE_MATCH_1}")
|
||||
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION_INTERNAL "${COMPILER_VERSION_INTERNAL}")
|
||||
endif()
|
||||
foreach(comp MAJOR MINOR PATCH TWEAK)
|
||||
foreach(digit 1 2 3 4 5 6 7 8 9)
|
||||
if("${info}" MATCHES "INFO:compiler_version_${comp}_digit_${digit}\\[([0-9])\\]")
|
||||
set(value ${CMAKE_MATCH_1})
|
||||
math(EXPR COMPILER_VERSION_${comp} "${COMPILER_VERSION_${comp}} + ${value} * ${DIGIT_VALUE_${digit}}")
|
||||
set(HAVE_COMPILER_VERSION_${comp} 1)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
if("${info}" MATCHES "INFO:compiler_wrapper\\[([^]\"]*)\\]")
|
||||
set(COMPILER_WRAPPER "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
if("${info}" MATCHES "INFO:simulate\\[([^]\"]*)\\]")
|
||||
set(SIMULATE_ID "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
if("${info}" MATCHES "INFO:simulate_version\\[([^]\"]*)\\]")
|
||||
string(REGEX REPLACE "^0+([0-9])" "\\1" SIMULATE_VERSION "${CMAKE_MATCH_1}")
|
||||
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" SIMULATE_VERSION "${SIMULATE_VERSION}")
|
||||
endif()
|
||||
if("${info}" MATCHES "INFO:qnxnto\\[\\]")
|
||||
set(COMPILER_QNXNTO 1)
|
||||
endif()
|
||||
if("${info}" MATCHES "INFO:dialect_default\\[([^]\"]*)\\]")
|
||||
set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Construct compiler version from components if needed.
|
||||
if(NOT DEFINED COMPILER_VERSION AND HAVE_COMPILER_VERSION_MAJOR)
|
||||
set(COMPILER_VERSION "${COMPILER_VERSION_MAJOR}")
|
||||
if(HAVE_COMPILER_VERSION_MINOR)
|
||||
string(APPEND COMPILER_VERSION ".${COMPILER_VERSION_MINOR}")
|
||||
if(HAVE_COMPILER_VERSION_PATCH)
|
||||
string(APPEND COMPILER_VERSION ".${COMPILER_VERSION_PATCH}")
|
||||
if(HAVE_COMPILER_VERSION_TWEAK)
|
||||
string(APPEND COMPILER_VERSION ".${COMPILER_VERSION_TWEAK}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Detect the exact architecture from the PE header.
|
||||
if(WIN32)
|
||||
# The offset to the PE signature is stored at 0x3c.
|
||||
file(READ ${file} peoffsethex LIMIT 1 OFFSET 60 HEX)
|
||||
if(NOT peoffsethex STREQUAL "")
|
||||
string(SUBSTRING "${peoffsethex}" 0 1 peoffsethex1)
|
||||
string(SUBSTRING "${peoffsethex}" 1 1 peoffsethex2)
|
||||
set(peoffsetexpression "${peoffsethex1} * 16 + ${peoffsethex2}")
|
||||
string(REPLACE "a" "10" peoffsetexpression "${peoffsetexpression}")
|
||||
string(REPLACE "b" "11" peoffsetexpression "${peoffsetexpression}")
|
||||
string(REPLACE "c" "12" peoffsetexpression "${peoffsetexpression}")
|
||||
string(REPLACE "d" "13" peoffsetexpression "${peoffsetexpression}")
|
||||
string(REPLACE "e" "14" peoffsetexpression "${peoffsetexpression}")
|
||||
string(REPLACE "f" "15" peoffsetexpression "${peoffsetexpression}")
|
||||
math(EXPR peoffset "${peoffsetexpression}")
|
||||
|
||||
file(READ ${file} peheader LIMIT 6 OFFSET ${peoffset} HEX)
|
||||
if(peheader STREQUAL "50450000a201")
|
||||
set(ARCHITECTURE_ID "SH3")
|
||||
elseif(peheader STREQUAL "50450000a301")
|
||||
set(ARCHITECTURE_ID "SH3DSP")
|
||||
elseif(peheader STREQUAL "50450000a601")
|
||||
set(ARCHITECTURE_ID "SH4")
|
||||
elseif(peheader STREQUAL "50450000a801")
|
||||
set(ARCHITECTURE_ID "SH5")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Check if a valid compiler and platform were found.
|
||||
if(COMPILER_ID AND NOT COMPILER_ID_TWICE)
|
||||
set(CMAKE_${lang}_COMPILER_ID "${COMPILER_ID}")
|
||||
set(CMAKE_${lang}_PLATFORM_ID "${PLATFORM_ID}")
|
||||
set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "${ARCHITECTURE_ID}")
|
||||
set(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}")
|
||||
set(CMAKE_${lang}_COMPILER_VERSION "${COMPILER_VERSION}")
|
||||
set(CMAKE_${lang}_COMPILER_VERSION_INTERNAL "${COMPILER_VERSION_INTERNAL}")
|
||||
set(CMAKE_${lang}_SIMULATE_ID "${SIMULATE_ID}")
|
||||
set(CMAKE_${lang}_SIMULATE_VERSION "${SIMULATE_VERSION}")
|
||||
endif()
|
||||
|
||||
# Check the compiler identification string.
|
||||
if(CMAKE_${lang}_COMPILER_ID)
|
||||
# The compiler identification was found.
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"The ${lang} compiler identification is ${CMAKE_${lang}_COMPILER_ID}, found in \""
|
||||
"${file}\"\n\n")
|
||||
else()
|
||||
# The compiler identification could not be found.
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"The ${lang} compiler identification could not be found in \""
|
||||
"${file}\"\n\n")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# try to figure out the executable format: ELF, COFF, Mach-O
|
||||
if(NOT CMAKE_EXECUTABLE_FORMAT)
|
||||
file(READ ${file} CMAKE_EXECUTABLE_MAGIC LIMIT 4 HEX)
|
||||
|
||||
# ELF files start with 0x7f"ELF"
|
||||
if("${CMAKE_EXECUTABLE_MAGIC}" STREQUAL "7f454c46")
|
||||
set(CMAKE_EXECUTABLE_FORMAT "ELF" CACHE INTERNAL "Executable file format")
|
||||
endif()
|
||||
|
||||
# # COFF (.exe) files start with "MZ"
|
||||
# if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "4d5a....")
|
||||
# set(CMAKE_EXECUTABLE_FORMAT "COFF" CACHE STRING "Executable file format")
|
||||
# endif()
|
||||
#
|
||||
# Mach-O files start with MH_MAGIC or MH_CIGAM
|
||||
if("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface|cefaedfe|feedfacf|cffaedfe")
|
||||
set(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_EXECUTABLE_FORMAT)
|
||||
set(CMAKE_EXECUTABLE_FORMAT)
|
||||
endif()
|
||||
# Return the information extracted.
|
||||
set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "${CMAKE_${lang}_COMPILER_ARCHITECTURE_ID}" PARENT_SCOPE)
|
||||
set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
|
||||
PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_VERSION_INTERNAL "${CMAKE_${lang}_COMPILER_VERSION_INTERNAL}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_WRAPPER "${COMPILER_WRAPPER}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE)
|
||||
set(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE)
|
||||
set(COMPILER_QNXNTO "${COMPILER_QNXNTO}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT "${CMAKE_${lang}_STANDARD_COMPUTED_DEFAULT}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Function to query the compiler vendor.
|
||||
# This uses a table with entries of the form
|
||||
# list(APPEND CMAKE_${lang}_COMPILER_ID_VENDORS ${vendor})
|
||||
# set(CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor} -some-vendor-flag)
|
||||
# set(CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor} "Some Vendor Output")
|
||||
# We try running the compiler with the flag for each vendor and
|
||||
# matching its regular expression in the output.
|
||||
function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang userflags)
|
||||
|
||||
if(NOT CMAKE_${lang}_COMPILER_ID_DIR)
|
||||
# We get here when this function is called not from within CMAKE_DETERMINE_COMPILER_ID()
|
||||
# This is done e.g. for detecting the compiler ID for assemblers.
|
||||
# Compute the directory in which to run the test and Create a clean working directory.
|
||||
set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang})
|
||||
file(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||
file(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||
endif()
|
||||
|
||||
# Save the current LC_ALL, LC_MESSAGES, and LANG environment variables
|
||||
# and set them to "C" so we get the expected output to match.
|
||||
set(_orig_lc_all $ENV{LC_ALL})
|
||||
set(_orig_lc_messages $ENV{LC_MESSAGES})
|
||||
set(_orig_lang $ENV{LANG})
|
||||
set(ENV{LC_ALL} C)
|
||||
set(ENV{LC_MESSAGES} C)
|
||||
set(ENV{LANG} C)
|
||||
|
||||
foreach(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS})
|
||||
set(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}})
|
||||
set(regex ${CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor}})
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_${lang}_COMPILER}"
|
||||
${CMAKE_${lang}_COMPILER_ID_ARG1}
|
||||
${userflags}
|
||||
${flags}
|
||||
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
|
||||
OUTPUT_VARIABLE output ERROR_VARIABLE output
|
||||
RESULT_VARIABLE result
|
||||
TIMEOUT 10
|
||||
)
|
||||
|
||||
if("${output}" MATCHES "${regex}")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" "
|
||||
"matched \"${regex}\":\n${output}")
|
||||
set(CMAKE_${lang}_COMPILER_ID "${vendor}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_ID_OUTPUT "${output}" PARENT_SCOPE)
|
||||
set(CMAKE_${lang}_COMPILER_ID_VENDOR_MATCH "${CMAKE_MATCH_1}" PARENT_SCOPE)
|
||||
break()
|
||||
else()
|
||||
if("${result}" MATCHES "timeout")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" "
|
||||
"terminated after 10 s due to timeout.")
|
||||
else()
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" "
|
||||
"did not match \"${regex}\":\n${output}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Restore original LC_ALL, LC_MESSAGES, and LANG
|
||||
set(ENV{LC_ALL} ${_orig_lc_all})
|
||||
set(ENV{LC_MESSAGES} ${_orig_lc_messages})
|
||||
set(ENV{LANG} ${_orig_lang})
|
||||
endfunction()
|
||||
|
||||
function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang userflags)
|
||||
# Run this MSVC-compatible compiler to detect what the /showIncludes
|
||||
# option displays. We can use a C source even with the C++ compiler
|
||||
# because MSVC-compatible compilers handle both and show the same output.
|
||||
set(showdir ${CMAKE_BINARY_DIR}/CMakeFiles/ShowIncludes)
|
||||
file(WRITE ${showdir}/foo.h "\n")
|
||||
file(WRITE ${showdir}/main.c "#include \"foo.h\" \nint main(){}\n")
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_${lang}_COMPILER}"
|
||||
${CMAKE_${lang}_COMPILER_ID_ARG1}
|
||||
${userflags}
|
||||
/nologo /showIncludes /c main.c
|
||||
WORKING_DIRECTORY ${showdir}
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_VARIABLE err
|
||||
RESULT_VARIABLE res
|
||||
ENCODING AUTO # cl prints in current code page
|
||||
)
|
||||
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()
|
||||
endfunction()
|
|
@ -0,0 +1,305 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# determine the compiler to use for Fortran programs
|
||||
# NOTE, a generator may set CMAKE_Fortran_COMPILER before
|
||||
# loading this file to force a compiler.
|
||||
# use environment variable FC first if defined by user, next use
|
||||
# the cmake variable CMAKE_GENERATOR_FC which can be defined by a generator
|
||||
# as a default compiler
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-Determine-Fortran OPTIONAL)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-Fortran OPTIONAL)
|
||||
if(NOT CMAKE_Fortran_COMPILER_NAMES)
|
||||
set(CMAKE_Fortran_COMPILER_NAMES f95)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
|
||||
elseif("${CMAKE_GENERATOR}" MATCHES "Xcode")
|
||||
set(CMAKE_Fortran_COMPILER_XCODE_TYPE sourcecode.fortran.f90)
|
||||
_cmake_find_compiler_path(Fortran)
|
||||
else()
|
||||
if(NOT CMAKE_Fortran_COMPILER)
|
||||
# prefer the environment variable CC
|
||||
if(NOT $ENV{FC} STREQUAL "")
|
||||
get_filename_component(CMAKE_Fortran_COMPILER_INIT $ENV{FC} PROGRAM PROGRAM_ARGS CMAKE_Fortran_FLAGS_ENV_INIT)
|
||||
if(CMAKE_Fortran_FLAGS_ENV_INIT)
|
||||
set(CMAKE_Fortran_COMPILER_ARG1 "${CMAKE_Fortran_FLAGS_ENV_INIT}" CACHE STRING "First argument to Fortran compiler")
|
||||
endif()
|
||||
if(EXISTS ${CMAKE_Fortran_COMPILER_INIT})
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find compiler set in environment variable FC:\n$ENV{FC}.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# next try prefer the compiler specified by the generator
|
||||
if(CMAKE_GENERATOR_FC)
|
||||
if(NOT CMAKE_Fortran_COMPILER_INIT)
|
||||
set(CMAKE_Fortran_COMPILER_INIT ${CMAKE_GENERATOR_FC})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# finally list compilers to try
|
||||
if(NOT CMAKE_Fortran_COMPILER_INIT)
|
||||
# Known compilers:
|
||||
# f77/f90/f95: generic compiler names
|
||||
# ftn: Cray fortran compiler wrapper
|
||||
# g77: GNU Fortran 77 compiler
|
||||
# gfortran: putative GNU Fortran 95+ compiler (in progress)
|
||||
# fort77: native F77 compiler under HP-UX (and some older Crays)
|
||||
# frt: Fujitsu F77 compiler
|
||||
# pathf90/pathf95/pathf2003: PathScale Fortran compiler
|
||||
# pgf77/pgf90/pgf95/pgfortran: Portland Group F77/F90/F95 compilers
|
||||
# flang: Flang Fortran compiler
|
||||
# xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers
|
||||
# lf95: Lahey-Fujitsu F95 compiler
|
||||
# fl32: Microsoft Fortran 77 "PowerStation" compiler
|
||||
# af77: Apogee F77 compiler for Intergraph hardware running CLIX
|
||||
# epcf90: "Edinburgh Portable Compiler" F90
|
||||
# fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha
|
||||
# ifc: Intel Fortran 95 compiler for Linux/x86
|
||||
# efc: Intel Fortran 95 compiler for IA64
|
||||
# nagfor: NAG Fortran compiler
|
||||
#
|
||||
# The order is 95 or newer compilers first, then 90,
|
||||
# then 77 or older compilers, gnu is always last in the group,
|
||||
# so if you paid for a compiler it is picked by default.
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(CMAKE_Fortran_COMPILER_LIST
|
||||
ifort pgf95 pgfortran lf95 fort
|
||||
flang gfortran gfortran-4 g95 f90 pgf90
|
||||
pgf77 g77 f77 nag
|
||||
)
|
||||
else()
|
||||
set(CMAKE_Fortran_COMPILER_LIST
|
||||
ftn
|
||||
ifort ifc efc pgf95 pgfortran lf95 xlf95 fort
|
||||
flang gfortran gfortran-4 g95 f90 pgf90
|
||||
frt pgf77 xlf g77 f77 nag
|
||||
)
|
||||
endif()
|
||||
|
||||
# Vendor-specific compiler names.
|
||||
set(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77)
|
||||
set(_Fortran_COMPILER_NAMES_Intel ifort ifc efc)
|
||||
set(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77)
|
||||
set(_Fortran_COMPILER_NAMES_PGI pgf95 pgfortran pgf90 pgf77)
|
||||
set(_Fortran_COMPILER_NAMES_Flang flang)
|
||||
set(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90)
|
||||
set(_Fortran_COMPILER_NAMES_XL xlf)
|
||||
set(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf)
|
||||
set(_Fortran_COMPILER_NAMES_NAG nagfor)
|
||||
endif()
|
||||
|
||||
_cmake_find_compiler(Fortran)
|
||||
|
||||
else()
|
||||
_cmake_find_compiler_path(Fortran)
|
||||
endif()
|
||||
mark_as_advanced(CMAKE_Fortran_COMPILER)
|
||||
|
||||
# Each entry in this list is a set of extra flags to try
|
||||
# adding to the compile line to see if it helps produce
|
||||
# a valid identification executable.
|
||||
set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS_FIRST
|
||||
# Get verbose output to help distinguish compilers.
|
||||
"-v"
|
||||
)
|
||||
set(CMAKE_Fortran_COMPILER_ID_TEST_FLAGS
|
||||
# Try compiling to an object file only.
|
||||
"-c"
|
||||
|
||||
# Intel on windows does not preprocess by default.
|
||||
"-fpp"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Build a small source file to identify the compiler.
|
||||
if(NOT CMAKE_Fortran_COMPILER_ID_RUN)
|
||||
set(CMAKE_Fortran_COMPILER_ID_RUN 1)
|
||||
|
||||
# Table of per-vendor compiler output regular expressions.
|
||||
list(APPEND CMAKE_Fortran_COMPILER_ID_MATCH_VENDORS CCur)
|
||||
set(CMAKE_Fortran_COMPILER_ID_MATCH_VENDOR_REGEX_CCur "Concurrent Fortran [0-9]+ Compiler")
|
||||
|
||||
# Table of per-vendor compiler id flags with expected output.
|
||||
list(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq)
|
||||
set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_Compaq "-what")
|
||||
set(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_Compaq "Compaq Visual Fortran")
|
||||
list(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS NAG) # Numerical Algorithms Group
|
||||
set(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_NAG "-V")
|
||||
set(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_NAG "NAG Fortran Compiler")
|
||||
|
||||
# Match the link line from xcodebuild output of the form
|
||||
# Ld ...
|
||||
# ...
|
||||
# /path/to/cc ...CompilerIdFortran/...
|
||||
# to extract the compiler front-end for the language.
|
||||
set(CMAKE_Fortran_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdFortran/(\\./)?(CompilerIdFortran.xctest/)?CompilerIdFortran[ \t\n\\\"]")
|
||||
set(CMAKE_Fortran_COMPILER_ID_TOOL_MATCH_INDEX 2)
|
||||
|
||||
set(_version_info "")
|
||||
foreach(m MAJOR MINOR PATCH TWEAK)
|
||||
set(_COMP "_${m}")
|
||||
string(APPEND _version_info "
|
||||
#if defined(COMPILER_VERSION${_COMP})")
|
||||
foreach(d 1 2 3 4 5 6 7 8)
|
||||
string(APPEND _version_info "
|
||||
# undef DEC
|
||||
# undef HEX
|
||||
# define DEC(n) DEC_${d}(n)
|
||||
# define HEX(n) HEX_${d}(n)
|
||||
# if COMPILER_VERSION${_COMP} == 0
|
||||
PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[0]'
|
||||
# elif COMPILER_VERSION${_COMP} == 1
|
||||
PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[1]'
|
||||
# elif COMPILER_VERSION${_COMP} == 2
|
||||
PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[2]'
|
||||
# elif COMPILER_VERSION${_COMP} == 3
|
||||
PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[3]'
|
||||
# elif COMPILER_VERSION${_COMP} == 4
|
||||
PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[4]'
|
||||
# elif COMPILER_VERSION${_COMP} == 5
|
||||
PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[5]'
|
||||
# elif COMPILER_VERSION${_COMP} == 6
|
||||
PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[6]'
|
||||
# elif COMPILER_VERSION${_COMP} == 7
|
||||
PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[7]'
|
||||
# elif COMPILER_VERSION${_COMP} == 8
|
||||
PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[8]'
|
||||
# elif COMPILER_VERSION${_COMP} == 9
|
||||
PRINT *, 'INFO:compiler_version${_COMP}_digit_${d}[9]'
|
||||
# endif
|
||||
")
|
||||
endforeach()
|
||||
string(APPEND _version_info "
|
||||
#endif")
|
||||
endforeach()
|
||||
set(CMAKE_Fortran_COMPILER_ID_VERSION_INFO "${_version_info}")
|
||||
unset(_version_info)
|
||||
unset(_COMP)
|
||||
|
||||
# Try to identify the compiler.
|
||||
set(CMAKE_Fortran_COMPILER_ID)
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
|
||||
CMAKE_DETERMINE_COMPILER_ID(Fortran FFLAGS CMakeFortranCompilerId.F)
|
||||
|
||||
_cmake_find_compiler_sysroot(Fortran)
|
||||
|
||||
# Fall back to old is-GNU test.
|
||||
if(NOT CMAKE_Fortran_COMPILER_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_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 "
|
||||
"the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
|
||||
else()
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if the Fortran compiler is GNU failed with "
|
||||
"the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
|
||||
endif()
|
||||
if(NOT CMAKE_Fortran_PLATFORM_ID)
|
||||
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()
|
||||
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)
|
||||
endif()
|
||||
if(CMAKE_Fortran_PLATFORM_ID MATCHES "MinGW")
|
||||
set(CMAKE_COMPILER_IS_MINGW 1)
|
||||
elseif(CMAKE_Fortran_PLATFORM_ID MATCHES "Cygwin")
|
||||
set(CMAKE_COMPILER_IS_CYGWIN 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
||||
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Fortran_COMPILER}" PATH)
|
||||
endif ()
|
||||
|
||||
# if we have a fortran cross compiler, they have usually some prefix, like
|
||||
# e.g. powerpc-linux-gfortran, arm-elf-gfortran or i586-mingw32msvc-gfortran , optionally
|
||||
# with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2).
|
||||
# The other tools of the toolchain usually have the same prefix
|
||||
# NAME_WE cannot be used since then this test will fail for names like
|
||||
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
|
||||
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
|
||||
if (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||
|
||||
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
|
||||
get_filename_component(COMPILER_BASENAME "${CMAKE_Fortran_COMPILER}" NAME)
|
||||
if (COMPILER_BASENAME MATCHES "^(.+-)g?fortran(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||
endif ()
|
||||
|
||||
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
|
||||
# but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
|
||||
if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
endif ()
|
||||
|
||||
set(_CMAKE_PROCESSING_LANGUAGE "Fortran")
|
||||
include(CMakeFindBinUtils)
|
||||
include(Compiler/${CMAKE_Fortran_COMPILER_ID}-FindBinUtils OPTIONAL)
|
||||
unset(_CMAKE_PROCESSING_LANGUAGE)
|
||||
|
||||
if(CMAKE_Fortran_XL_CPP)
|
||||
set(_SET_CMAKE_Fortran_XL_CPP
|
||||
"set(CMAKE_Fortran_XL_CPP \"${CMAKE_Fortran_XL_CPP}\")")
|
||||
endif()
|
||||
|
||||
if(CMAKE_Fortran_COMPILER_SYSROOT)
|
||||
string(CONCAT _SET_CMAKE_Fortran_COMPILER_SYSROOT
|
||||
"set(CMAKE_Fortran_COMPILER_SYSROOT \"${CMAKE_Fortran_COMPILER_SYSROOT}\")\n"
|
||||
"set(CMAKE_COMPILER_SYSROOT \"${CMAKE_Fortran_COMPILER_SYSROOT}\")")
|
||||
else()
|
||||
set(_SET_CMAKE_Fortran_COMPILER_SYSROOT "")
|
||||
endif()
|
||||
|
||||
if(CMAKE_Fortran_COMPILER_ARCHITECTURE_ID)
|
||||
set(_SET_CMAKE_Fortran_COMPILER_ARCHITECTURE_ID
|
||||
"set(CMAKE_Fortran_COMPILER_ARCHITECTURE_ID ${CMAKE_Fortran_COMPILER_ARCHITECTURE_ID})")
|
||||
else()
|
||||
set(_SET_CMAKE_Fortran_COMPILER_ARCHITECTURE_ID "")
|
||||
endif()
|
||||
|
||||
if(MSVC_Fortran_ARCHITECTURE_ID)
|
||||
set(SET_MSVC_Fortran_ARCHITECTURE_ID
|
||||
"set(MSVC_Fortran_ARCHITECTURE_ID ${MSVC_Fortran_ARCHITECTURE_ID})")
|
||||
endif()
|
||||
# configure variables set in this file for fast reload later on
|
||||
configure_file(${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake
|
||||
@ONLY
|
||||
)
|
||||
set(CMAKE_Fortran_COMPILER_ENV_VAR "FC")
|
|
@ -0,0 +1,94 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# determine the compiler to use for Java programs
|
||||
# NOTE, a generator may set CMAKE_Java_COMPILER before
|
||||
# loading this file to force a compiler.
|
||||
|
||||
if(NOT CMAKE_Java_COMPILER)
|
||||
# prefer the environment variable CC
|
||||
if(NOT $ENV{JAVA_COMPILER} STREQUAL "")
|
||||
get_filename_component(CMAKE_Java_COMPILER_INIT $ENV{JAVA_COMPILER} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
|
||||
if(CMAKE_Java_FLAGS_ENV_INIT)
|
||||
set(CMAKE_Java_COMPILER_ARG1 "${CMAKE_Java_FLAGS_ENV_INIT}" CACHE STRING "First argument to Java compiler")
|
||||
endif()
|
||||
if(NOT EXISTS ${CMAKE_Java_COMPILER_INIT})
|
||||
message(SEND_ERROR "Could not find compiler set in environment variable JAVA_COMPILER:\n$ENV{JAVA_COMPILER}.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT $ENV{JAVA_RUNTIME} STREQUAL "")
|
||||
get_filename_component(CMAKE_Java_RUNTIME_INIT $ENV{JAVA_RUNTIME} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
|
||||
if(NOT EXISTS ${CMAKE_Java_RUNTIME_INIT})
|
||||
message(SEND_ERROR "Could not find compiler set in environment variable JAVA_RUNTIME:\n$ENV{JAVA_RUNTIME}.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT $ENV{JAVA_ARCHIVE} STREQUAL "")
|
||||
get_filename_component(CMAKE_Java_ARCHIVE_INIT $ENV{JAVA_ARCHIVE} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
|
||||
if(NOT EXISTS ${CMAKE_Java_ARCHIVE_INIT})
|
||||
message(SEND_ERROR "Could not find compiler set in environment variable JAVA_ARCHIVE:\n$ENV{JAVA_ARCHIVE}.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(Java_BIN_PATH
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\2.0;JavaHome]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7;JavaHome]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.6;JavaHome]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin"
|
||||
$ENV{JAVA_HOME}/bin
|
||||
/usr/bin
|
||||
/usr/lib/java/bin
|
||||
/usr/share/java/bin
|
||||
/usr/local/bin
|
||||
/usr/local/java/bin
|
||||
/usr/local/java/share/bin
|
||||
/usr/java/j2sdk1.4.2_04
|
||||
/usr/lib/j2sdk1.4-sun/bin
|
||||
/usr/java/j2sdk1.4.2_09/bin
|
||||
/usr/lib/j2sdk1.5-sun/bin
|
||||
/opt/sun-jdk-1.5.0.04/bin
|
||||
/usr/local/jdk-1.7.0/bin
|
||||
/usr/local/jdk-1.6.0/bin
|
||||
)
|
||||
# if no compiler has been specified yet, then look for one
|
||||
if(CMAKE_Java_COMPILER_INIT)
|
||||
set(CMAKE_Java_COMPILER ${CMAKE_Java_COMPILER_INIT} CACHE PATH "Java Compiler")
|
||||
else()
|
||||
find_program(CMAKE_Java_COMPILER
|
||||
NAMES javac
|
||||
PATHS ${Java_BIN_PATH}
|
||||
)
|
||||
endif()
|
||||
|
||||
# if no runtime has been specified yet, then look for one
|
||||
if(CMAKE_Java_RUNTIME_INIT)
|
||||
set(CMAKE_Java_RUNTIME ${CMAKE_Java_RUNTIME_INIT} CACHE PATH "Java Compiler")
|
||||
else()
|
||||
find_program(CMAKE_Java_RUNTIME
|
||||
NAMES java
|
||||
PATHS ${Java_BIN_PATH}
|
||||
)
|
||||
endif()
|
||||
|
||||
# if no archive has been specified yet, then look for one
|
||||
if(CMAKE_Java_ARCHIVE_INIT)
|
||||
set(CMAKE_Java_ARCHIVE ${CMAKE_Java_ARCHIVE_INIT} CACHE PATH "Java Compiler")
|
||||
else()
|
||||
find_program(CMAKE_Java_ARCHIVE
|
||||
NAMES jar
|
||||
PATHS ${Java_BIN_PATH}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
mark_as_advanced(CMAKE_Java_COMPILER)
|
||||
|
||||
# configure variables set in this file for fast reload later on
|
||||
configure_file(${CMAKE_ROOT}/Modules/CMakeJavaCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeJavaCompiler.cmake @ONLY)
|
||||
set(CMAKE_Java_COMPILER_ENV_VAR "JAVA_COMPILER")
|
|
@ -0,0 +1,192 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# determine the compiler to use for Objective-C programs
|
||||
# NOTE, a generator may set CMAKE_OBJC_COMPILER before
|
||||
# loading this file to force a compiler.
|
||||
# use environment variable OBJC first if defined by user, next use
|
||||
# the cmake variable CMAKE_GENERATOR_OBJC which can be defined by a generator
|
||||
# as a default compiler
|
||||
#
|
||||
# Sets the following variables:
|
||||
# CMAKE_OBJC_COMPILER
|
||||
# CMAKE_AR
|
||||
# CMAKE_RANLIB
|
||||
# CMAKE_COMPILER_IS_GNUOBJC
|
||||
# CMAKE_COMPILER_IS_CLANGOBJC
|
||||
#
|
||||
# If not already set before, it also sets
|
||||
# _CMAKE_TOOLCHAIN_PREFIX
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
|
||||
|
||||
# Load system-specific compiler preferences for this language.
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-Determine-OBJC OPTIONAL)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-OBJC OPTIONAL)
|
||||
if(NOT CMAKE_OBJC_COMPILER_NAMES)
|
||||
set(CMAKE_OBJC_COMPILER_NAMES clang)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_GENERATOR}" MATCHES "Xcode")
|
||||
set(CMAKE_OBJC_COMPILER_XCODE_TYPE sourcecode.c.objc)
|
||||
else()
|
||||
if(NOT CMAKE_OBJC_COMPILER)
|
||||
set(CMAKE_OBJC_COMPILER_INIT NOTFOUND)
|
||||
|
||||
# prefer the environment variable OBJC or CC
|
||||
foreach(var OBJC CC)
|
||||
if($ENV{${var}} MATCHES ".+")
|
||||
get_filename_component(CMAKE_OBJC_COMPILER_INIT $ENV{${var}} PROGRAM PROGRAM_ARGS CMAKE_OBJC_FLAGS_ENV_INIT)
|
||||
if(CMAKE_OBJC_FLAGS_ENV_INIT)
|
||||
set(CMAKE_OBJC_COMPILER_ARG1 "${CMAKE_OBJC_FLAGS_ENV_INIT}" CACHE STRING "First argument to Objective-C compiler")
|
||||
endif()
|
||||
if(NOT EXISTS ${CMAKE_OBJC_COMPILER_INIT})
|
||||
message(FATAL_ERROR "Could not find compiler set in environment variable ${var}:\n $ENV{${var}}")
|
||||
endif()
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# next try prefer the compiler specified by the generator
|
||||
if(CMAKE_GENERATOR_OBJC)
|
||||
if(NOT CMAKE_OBJC_COMPILER_INIT)
|
||||
set(CMAKE_OBJC_COMPILER_INIT ${CMAKE_GENERATOR_OBJC})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# finally list compilers to try
|
||||
if(NOT CMAKE_OBJC_COMPILER_INIT)
|
||||
set(CMAKE_OBJC_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}cc ${_CMAKE_TOOLCHAIN_PREFIX}gcc clang)
|
||||
endif()
|
||||
|
||||
_cmake_find_compiler(OBJC)
|
||||
|
||||
else()
|
||||
# we only get here if CMAKE_OBJC_COMPILER was specified using -D or a pre-made CMakeCache.txt
|
||||
# (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
|
||||
# if CMAKE_OBJC_COMPILER is a list of length 2, use the first item as
|
||||
# CMAKE_OBJC_COMPILER and the 2nd one as CMAKE_OBJC_COMPILER_ARG1
|
||||
|
||||
list(LENGTH CMAKE_OBJC_COMPILER _CMAKE_OBJC_COMPILER_LIST_LENGTH)
|
||||
if("${_CMAKE_OBJC_COMPILER_LIST_LENGTH}" EQUAL 2)
|
||||
list(GET CMAKE_OBJC_COMPILER 1 CMAKE_OBJC_COMPILER_ARG1)
|
||||
list(GET CMAKE_OBJC_COMPILER 0 CMAKE_OBJC_COMPILER)
|
||||
endif()
|
||||
|
||||
# if a compiler was specified by the user but without path,
|
||||
# now try to find it with the full path
|
||||
# if it is found, force it into the cache,
|
||||
# if not, don't overwrite the setting (which was given by the user) with "NOTFOUND"
|
||||
# if the C compiler already had a path, reuse it for searching the CXX compiler
|
||||
get_filename_component(_CMAKE_USER_OBJC_COMPILER_PATH "${CMAKE_OBJC_COMPILER}" PATH)
|
||||
if(NOT _CMAKE_USER_OBJC_COMPILER_PATH)
|
||||
find_program(CMAKE_OBJC_COMPILER_WITH_PATH NAMES ${CMAKE_OBJC_COMPILER})
|
||||
if(CMAKE_OBJC_COMPILER_WITH_PATH)
|
||||
set(CMAKE_OBJC_COMPILER ${CMAKE_OBJC_COMPILER_WITH_PATH} CACHE STRING "Objective-C compiler" FORCE)
|
||||
endif()
|
||||
unset(CMAKE_OBJC_COMPILER_WITH_PATH CACHE)
|
||||
endif()
|
||||
endif()
|
||||
mark_as_advanced(CMAKE_OBJC_COMPILER)
|
||||
|
||||
# Each entry in this list is a set of extra flags to try
|
||||
# adding to the compile line to see if it helps produce
|
||||
# a valid identification file.
|
||||
set(CMAKE_OBJC_COMPILER_ID_TEST_FLAGS_FIRST)
|
||||
set(CMAKE_OBJC_COMPILER_ID_TEST_FLAGS
|
||||
# Try compiling to an object file only.
|
||||
"-c"
|
||||
|
||||
)
|
||||
endif()
|
||||
|
||||
# Build a small source file to identify the compiler.
|
||||
if(NOT CMAKE_OBJC_COMPILER_ID_RUN)
|
||||
set(CMAKE_OBJC_COMPILER_ID_RUN 1)
|
||||
|
||||
# Try to identify the compiler.
|
||||
set(CMAKE_OBJC_COMPILER_ID)
|
||||
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
|
||||
CMAKE_OBJC_COMPILER_ID_PLATFORM_CONTENT)
|
||||
|
||||
# Match the link line from xcodebuild output of the form
|
||||
# Ld ...
|
||||
# ...
|
||||
# /path/to/cc ...CompilerIdOBJC/...
|
||||
# to extract the compiler front-end for the language.
|
||||
set(CMAKE_OBJC_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdOBJC/(\\./)?(CompilerIdOBJC.(framework|xctest)/)?CompilerIdOBJC[ \t\n\\\"]")
|
||||
set(CMAKE_OBJC_COMPILER_ID_TOOL_MATCH_INDEX 2)
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
|
||||
CMAKE_DETERMINE_COMPILER_ID(OBJC OBJCCFLAGS CMakeOBJCCompilerId.m)
|
||||
|
||||
# Set old compiler and platform id variables.
|
||||
if(CMAKE_OBJC_COMPILER_ID STREQUAL "GNU")
|
||||
set(CMAKE_COMPILER_IS_GNUOBJC 1)
|
||||
endif()
|
||||
if(CMAKE_OBJC_COMPILER_ID STREQUAL "Clang")
|
||||
set(CMAKE_COMPILER_IS_CLANGOBJC 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
||||
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_OBJC_COMPILER}" PATH)
|
||||
endif ()
|
||||
|
||||
# If we have a gcc cross compiler, they have usually some prefix, like
|
||||
# e.g. powerpc-linux-gcc, arm-elf-gcc or i586-mingw32msvc-gcc, optionally
|
||||
# with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2).
|
||||
# The other tools of the toolchain usually have the same prefix
|
||||
# NAME_WE cannot be used since then this test will fail for names like
|
||||
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
|
||||
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
|
||||
if (CMAKE_CROSSCOMPILING AND NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||
|
||||
if(CMAKE_OBJC_COMPILER_ID MATCHES "GNU|Clang|QCC")
|
||||
get_filename_component(COMPILER_BASENAME "${CMAKE_OBJC_COMPILER}" NAME)
|
||||
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_OBJC_COMPILER_ID MATCHES "Clang")
|
||||
if(CMAKE_OBJC_COMPILER_TARGET)
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_OBJC_COMPILER_TARGET}-)
|
||||
endif()
|
||||
elseif(COMPILER_BASENAME MATCHES "qcc(\\.exe)?$")
|
||||
if(CMAKE_OBJC_COMPILER_TARGET MATCHES "gcc_nto([a-z0-9]+_[0-9]+|[^_le]+)(le)?")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
|
||||
# but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
|
||||
if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
endif ()
|
||||
|
||||
set(_CMAKE_PROCESSING_LANGUAGE "OBJC")
|
||||
include(CMakeFindBinUtils)
|
||||
include(Compiler/${CMAKE_OBJC_COMPILER_ID}-FindBinUtils OPTIONAL)
|
||||
unset(_CMAKE_PROCESSING_LANGUAGE)
|
||||
|
||||
if(CMAKE_OBJC_COMPILER_ARCHITECTURE_ID)
|
||||
set(_SET_CMAKE_OBJC_COMPILER_ARCHITECTURE_ID
|
||||
"set(CMAKE_OBJC_COMPILER_ARCHITECTURE_ID ${CMAKE_OBJC_COMPILER_ARCHITECTURE_ID})")
|
||||
else()
|
||||
set(_SET_CMAKE_OBJC_COMPILER_ARCHITECTURE_ID "")
|
||||
endif()
|
||||
|
||||
if(CMAKE_OBJC_XCODE_ARCHS)
|
||||
set(SET_CMAKE_XCODE_ARCHS
|
||||
"set(CMAKE_XCODE_ARCHS \"${CMAKE_OBJC_XCODE_ARCHS}\")")
|
||||
endif()
|
||||
|
||||
# configure variables set in this file for fast reload later on
|
||||
configure_file(${CMAKE_ROOT}/Modules/CMakeOBJCCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeOBJCCompiler.cmake
|
||||
@ONLY
|
||||
)
|
||||
set(CMAKE_OBJC_COMPILER_ENV_VAR "OBJC")
|
|
@ -0,0 +1,200 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# determine the compiler to use for Objective-C++ programs
|
||||
# NOTE, a generator may set CMAKE_OBJCXX_COMPILER before
|
||||
# loading this file to force a compiler.
|
||||
# use environment variable OBJCXX first if defined by user, next use
|
||||
# the cmake variable CMAKE_GENERATOR_OBJCXX which can be defined by a generator
|
||||
# as a default compiler
|
||||
# If the internal cmake variable _CMAKE_TOOLCHAIN_PREFIX is set, this is used
|
||||
# as prefix for the tools (e.g. arm-elf-g++, arm-elf-ar etc.)
|
||||
#
|
||||
# Sets the following variables:
|
||||
# CMAKE_OBJCXX_COMPILER
|
||||
# CMAKE_COMPILER_IS_GNUOBJCXX
|
||||
# CMAKE_COMPILER_IS_CLANGOBJCXX
|
||||
# CMAKE_AR
|
||||
# CMAKE_RANLIB
|
||||
#
|
||||
# If not already set before, it also sets
|
||||
# _CMAKE_TOOLCHAIN_PREFIX
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
|
||||
|
||||
# Load system-specific compiler preferences for this language.
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-Determine-OBJCXX OPTIONAL)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-OBJCXX OPTIONAL)
|
||||
if(NOT CMAKE_OBJCXX_COMPILER_NAMES)
|
||||
set(CMAKE_OBJCXX_COMPILER_NAMES clang++)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_GENERATOR}" MATCHES "Xcode")
|
||||
set(CMAKE_OBJCXX_COMPILER_XCODE_TYPE sourcecode.cpp.objcpp)
|
||||
else()
|
||||
if(NOT CMAKE_OBJCXX_COMPILER)
|
||||
set(CMAKE_OBJCXX_COMPILER_INIT NOTFOUND)
|
||||
|
||||
# prefer the environment variable OBJCXX or CXX
|
||||
foreach(var OBJCXX CXX)
|
||||
if($ENV{${var}} MATCHES ".+")
|
||||
get_filename_component(CMAKE_OBJCXX_COMPILER_INIT $ENV{${var}} PROGRAM PROGRAM_ARGS CMAKE_OBJCXX_FLAGS_ENV_INIT)
|
||||
if(CMAKE_OBJCXX_FLAGS_ENV_INIT)
|
||||
set(CMAKE_OBJCXX_COMPILER_ARG1 "${CMAKE_OBJCXX_FLAGS_ENV_INIT}" CACHE STRING "First argument to Objective-C++ compiler")
|
||||
endif()
|
||||
if(NOT EXISTS ${CMAKE_OBJCXX_COMPILER_INIT})
|
||||
message(FATAL_ERROR "Could not find compiler set in environment variable ${var}:\n $ENV{${var}}")
|
||||
endif()
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# next prefer the generator specified compiler
|
||||
if(CMAKE_GENERATOR_OBJCXX)
|
||||
if(NOT CMAKE_OBJCXX_COMPILER_INIT)
|
||||
set(CMAKE_OBJCXX_COMPILER_INIT ${CMAKE_GENERATOR_OBJCXX})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# finally list compilers to try
|
||||
if(NOT CMAKE_OBJCXX_COMPILER_INIT)
|
||||
set(CMAKE_OBJCXX_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ clang++)
|
||||
endif()
|
||||
|
||||
_cmake_find_compiler(OBJCXX)
|
||||
|
||||
else()
|
||||
# we only get here if CMAKE_OBJCXX_COMPILER was specified using -D or a pre-made CMakeCache.txt
|
||||
# (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
|
||||
# if CMAKE_OBJCXX_COMPILER is a list of length 2, use the first item as
|
||||
# CMAKE_OBJCXX_COMPILER and the 2nd one as CMAKE_OBJCXX_COMPILER_ARG1
|
||||
|
||||
list(LENGTH CMAKE_OBJCXX_COMPILER _CMAKE_OBJCXX_COMPILER_LIST_LENGTH)
|
||||
if("${_CMAKE_OBJCXX_COMPILER_LIST_LENGTH}" EQUAL 2)
|
||||
list(GET CMAKE_OBJCXX_COMPILER 1 CMAKE_OBJCXX_COMPILER_ARG1)
|
||||
list(GET CMAKE_OBJCXX_COMPILER 0 CMAKE_OBJCXX_COMPILER)
|
||||
endif()
|
||||
|
||||
# if a compiler was specified by the user but without path,
|
||||
# now try to find it with the full path
|
||||
# if it is found, force it into the cache,
|
||||
# if not, don't overwrite the setting (which was given by the user) with "NOTFOUND"
|
||||
# if the C compiler already had a path, reuse it for searching the CXX compiler
|
||||
get_filename_component(_CMAKE_USER_OBJCXX_COMPILER_PATH "${CMAKE_OBJCXX_COMPILER}" PATH)
|
||||
if(NOT _CMAKE_USER_OBJCXX_COMPILER_PATH)
|
||||
find_program(CMAKE_OBJCXX_COMPILER_WITH_PATH NAMES ${CMAKE_OBJCXX_COMPILER})
|
||||
if(CMAKE_OBJCXX_COMPILER_WITH_PATH)
|
||||
set(CMAKE_OBJCXX_COMPILER ${CMAKE_OBJCXX_COMPILER_WITH_PATH} CACHE STRING "Objective-C++ compiler" FORCE)
|
||||
endif()
|
||||
unset(CMAKE_OBJCXX_COMPILER_WITH_PATH CACHE)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
mark_as_advanced(CMAKE_OBJCXX_COMPILER)
|
||||
|
||||
# Each entry in this list is a set of extra flags to try
|
||||
# adding to the compile line to see if it helps produce
|
||||
# a valid identification file.
|
||||
set(CMAKE_OBJCXX_COMPILER_ID_TEST_FLAGS_FIRST)
|
||||
set(CMAKE_OBJCXX_COMPILER_ID_TEST_FLAGS
|
||||
# Try compiling to an object file only.
|
||||
"-c"
|
||||
|
||||
# ARMClang need target options
|
||||
"--target=arm-arm-none-eabi -mcpu=cortex-m3"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Build a small source file to identify the compiler.
|
||||
if(NOT CMAKE_OBJCXX_COMPILER_ID_RUN)
|
||||
set(CMAKE_OBJCXX_COMPILER_ID_RUN 1)
|
||||
|
||||
# Try to identify the compiler.
|
||||
set(CMAKE_OBJCXX_COMPILER_ID)
|
||||
file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in
|
||||
CMAKE_OBJCXX_COMPILER_ID_PLATFORM_CONTENT)
|
||||
|
||||
# Match the link line from xcodebuild output of the form
|
||||
# Ld ...
|
||||
# ...
|
||||
# /path/to/cc ...CompilerIdOBJCXX/...
|
||||
# to extract the compiler front-end for the language.
|
||||
set(CMAKE_OBJCXX_COMPILER_ID_TOOL_MATCH_REGEX "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerIdOBJCXX/(\\./)?(CompilerIdOBJCXX.(framework|xctest)/)?CompilerIdOBJCXX[ \t\n\\\"]")
|
||||
set(CMAKE_OBJCXX_COMPILER_ID_TOOL_MATCH_INDEX 2)
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
|
||||
CMAKE_DETERMINE_COMPILER_ID(OBJCXX OBJCXXFLAGS CMakeOBJCXXCompilerId.mm)
|
||||
|
||||
# Set old compiler and platform id variables.
|
||||
if(CMAKE_OBJCXX_COMPILER_ID MATCHES "GNU")
|
||||
set(CMAKE_COMPILER_IS_GNUOBJCXX 1)
|
||||
endif()
|
||||
if(CMAKE_OBJCXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_COMPILER_IS_CLANGOBJCXX 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
||||
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_OBJCXX_COMPILER}" PATH)
|
||||
endif ()
|
||||
|
||||
# if we have a g++ cross compiler, they have usually some prefix, like
|
||||
# e.g. powerpc-linux-g++, arm-elf-g++ or i586-mingw32msvc-g++ , optionally
|
||||
# with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2).
|
||||
# The other tools of the toolchain usually have the same prefix
|
||||
# NAME_WE cannot be used since then this test will fail for names like
|
||||
# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be
|
||||
# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-"
|
||||
|
||||
|
||||
if (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||
|
||||
if("${CMAKE_OBJCXX_COMPILER_ID}" MATCHES "GNU|Clang|QCC")
|
||||
get_filename_component(COMPILER_BASENAME "${CMAKE_OBJCXX_COMPILER}" NAME)
|
||||
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_OBJCXX_COMPILER_ID}" MATCHES "Clang")
|
||||
if(CMAKE_OBJCXX_COMPILER_TARGET)
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_OBJCXX_COMPILER_TARGET}-)
|
||||
endif()
|
||||
elseif(COMPILER_BASENAME MATCHES "QCC(\\.exe)?$")
|
||||
if(CMAKE_OBJCXX_COMPILER_TARGET MATCHES "gcc_nto([a-z0-9]+_[0-9]+|[^_le]+)(le)")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils
|
||||
# but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.)
|
||||
if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
endif ()
|
||||
|
||||
set(_CMAKE_PROCESSING_LANGUAGE "OBJCXX")
|
||||
include(CMakeFindBinUtils)
|
||||
include(Compiler/${CMAKE_OBJCXX_COMPILER_ID}-FindBinUtils OPTIONAL)
|
||||
unset(_CMAKE_PROCESSING_LANGUAGE)
|
||||
|
||||
if(CMAKE_OBJCXX_COMPILER_ARCHITECTURE_ID)
|
||||
set(_SET_CMAKE_OBJCXX_COMPILER_ARCHITECTURE_ID
|
||||
"set(CMAKE_OBJCXX_COMPILER_ARCHITECTURE_ID ${CMAKE_OBJCXX_COMPILER_ARCHITECTURE_ID})")
|
||||
else()
|
||||
set(_SET_CMAKE_OBJCXX_COMPILER_ARCHITECTURE_ID "")
|
||||
endif()
|
||||
|
||||
if(CMAKE_OBJCXX_XCODE_ARCHS)
|
||||
set(SET_CMAKE_XCODE_ARCHS
|
||||
"set(CMAKE_XCODE_ARCHS \"${CMAKE_OBJCXX_XCODE_ARCHS}\")")
|
||||
endif()
|
||||
|
||||
# configure all variables set in this file
|
||||
configure_file(${CMAKE_ROOT}/Modules/CMakeOBJCXXCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeOBJCXXCompiler.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
set(CMAKE_OBJCXX_COMPILER_ENV_VAR "OBJCXX")
|
|
@ -0,0 +1,57 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# determine the compiler to use for RC programs
|
||||
# NOTE, a generator may set CMAKE_RC_COMPILER before
|
||||
# loading this file to force a compiler.
|
||||
# use environment variable RC first if defined by user, next use
|
||||
# the cmake variable CMAKE_GENERATOR_RC which can be defined by a generator
|
||||
# as a default compiler
|
||||
if(NOT CMAKE_RC_COMPILER)
|
||||
# prefer the environment variable RC
|
||||
if(NOT $ENV{RC} STREQUAL "")
|
||||
get_filename_component(CMAKE_RC_COMPILER_INIT $ENV{RC} PROGRAM PROGRAM_ARGS CMAKE_RC_FLAGS_ENV_INIT)
|
||||
if(CMAKE_RC_FLAGS_ENV_INIT)
|
||||
set(CMAKE_RC_COMPILER_ARG1 "${CMAKE_RC_FLAGS_ENV_INIT}" CACHE STRING "First argument to RC compiler")
|
||||
endif()
|
||||
if(EXISTS ${CMAKE_RC_COMPILER_INIT})
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find compiler set in environment variable RC:\n$ENV{RC}.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# next try prefer the compiler specified by the generator
|
||||
if(CMAKE_GENERATOR_RC)
|
||||
if(NOT CMAKE_RC_COMPILER_INIT)
|
||||
set(CMAKE_RC_COMPILER_INIT ${CMAKE_GENERATOR_RC})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# finally list compilers to try
|
||||
if(CMAKE_RC_COMPILER_INIT)
|
||||
set(CMAKE_RC_COMPILER_LIST ${CMAKE_RC_COMPILER_INIT})
|
||||
else()
|
||||
set(CMAKE_RC_COMPILER_LIST rc)
|
||||
endif()
|
||||
|
||||
# Find the compiler.
|
||||
find_program(CMAKE_RC_COMPILER NAMES ${CMAKE_RC_COMPILER_LIST} DOC "RC compiler")
|
||||
if(CMAKE_RC_COMPILER_INIT AND NOT CMAKE_RC_COMPILER)
|
||||
set(CMAKE_RC_COMPILER "${CMAKE_RC_COMPILER_INIT}" CACHE FILEPATH "RC compiler" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CMAKE_RC_COMPILER)
|
||||
|
||||
get_filename_component(_CMAKE_RC_COMPILER_NAME_WE ${CMAKE_RC_COMPILER} NAME_WE)
|
||||
if(_CMAKE_RC_COMPILER_NAME_WE STREQUAL "windres")
|
||||
set(CMAKE_RC_OUTPUT_EXTENSION .obj)
|
||||
else()
|
||||
set(CMAKE_RC_OUTPUT_EXTENSION .res)
|
||||
endif()
|
||||
|
||||
# configure variables set in this file for fast reload later on
|
||||
configure_file(${CMAKE_ROOT}/Modules/CMakeRCCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeRCCompiler.cmake)
|
||||
set(CMAKE_RC_COMPILER_ENV_VAR "RC")
|
|
@ -0,0 +1,78 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
|
||||
|
||||
# Local system-specific compiler preferences for this language.
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-Determine-Swift OPTIONAL)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-Swift OPTIONAL)
|
||||
if(NOT CMAKE_Swift_COMPILER_NAMES)
|
||||
set(CMAKE_Swift_COMPILER_NAMES swiftc)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
|
||||
if(XCODE_VERSION VERSION_LESS 6.1)
|
||||
message(FATAL_ERROR "Swift language not supported by Xcode ${XCODE_VERSION}")
|
||||
endif()
|
||||
set(CMAKE_Swift_COMPILER_XCODE_TYPE sourcecode.swift)
|
||||
_cmake_find_compiler_path(Swift)
|
||||
elseif("${CMAKE_GENERATOR}" MATCHES "^Ninja")
|
||||
if(CMAKE_Swift_COMPILER)
|
||||
_cmake_find_compiler_path(Swift)
|
||||
else()
|
||||
set(CMAKE_Swift_COMPILER_INIT NOTFOUND)
|
||||
|
||||
if(NOT $ENV{SWIFTC} STREQUAL "")
|
||||
get_filename_component(CMAKE_Swift_COMPILER_INIT $ENV{SWIFTC} PROGRAM
|
||||
PROGRAM_ARGS CMAKE_Swift_FLAGS_ENV_INIT)
|
||||
if(CMAKE_Swift_FLAGS_ENV_INIT)
|
||||
set(CMAKE_Swift_COMPILER_ARG1 "${CMAKE_Swift_FLAGS_ENV_INIT}" CACHE
|
||||
STRING "First argument to the Swift compiler")
|
||||
endif()
|
||||
if(NOT EXISTS ${CMAKE_Swift_COMPILER_INIT})
|
||||
message(FATAL_ERROR "Could not find compiler set in environment variable SWIFTC\n$ENV{SWIFTC}.\n${CMAKE_Swift_COMPILER_INIT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_Swift_COMPILER_INIT)
|
||||
set(CMAKE_Swift_COMPILER_LIST swiftc ${_CMAKE_TOOLCHAIN_PREFIX}swiftc)
|
||||
endif()
|
||||
|
||||
_cmake_find_compiler(Swift)
|
||||
endif()
|
||||
mark_as_advanced(CMAKE_Swift_COMPILER)
|
||||
else()
|
||||
message(FATAL_ERROR "Swift language not supported by \"${CMAKE_GENERATOR}\" generator")
|
||||
endif()
|
||||
|
||||
# Build a small source file to identify the compiler.
|
||||
if(NOT CMAKE_Swift_COMPILER_ID_RUN)
|
||||
set(CMAKE_Swift_COMPILER_ID_RUN 1)
|
||||
|
||||
if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
|
||||
list(APPEND CMAKE_Swift_COMPILER_ID_MATCH_VENDORS Apple)
|
||||
set(CMAKE_Swift_COMPILER_ID_MATCH_VENDOR_REGEX_Apple "com.apple.xcode.tools.swift.compiler")
|
||||
|
||||
set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_REGEX "\nCompileSwift[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]* -c[^\r\n]*CompilerIdSwift/CompilerId/main.swift")
|
||||
set(CMAKE_Swift_COMPILER_ID_TOOL_MATCH_INDEX 2)
|
||||
endif()
|
||||
|
||||
# Try to identify the compiler.
|
||||
set(CMAKE_Swift_COMPILER_ID)
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
|
||||
CMAKE_DETERMINE_COMPILER_ID(Swift "" CompilerId/main.swift)
|
||||
endif()
|
||||
|
||||
if (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
||||
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Swift_COMPILER}" PATH)
|
||||
endif ()
|
||||
|
||||
set(_CMAKE_PROCESSING_LANGUAGE "Swift")
|
||||
include(CMakeFindBinUtils)
|
||||
unset(_CMAKE_PROCESSING_LANGUAGE)
|
||||
|
||||
# configure variables set in this file for fast reload later on
|
||||
configure_file(${CMAKE_ROOT}/Modules/CMakeSwiftCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeSwiftCompiler.cmake @ONLY)
|
||||
|
||||
set(CMAKE_Swift_COMPILER_ENV_VAR "SWIFTC")
|
|
@ -0,0 +1,189 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This module is used by the Makefile generator to determine the following variables:
|
||||
# CMAKE_SYSTEM_NAME - on unix this is uname -s, for windows it is Windows
|
||||
# CMAKE_SYSTEM_VERSION - on unix this is uname -r, for windows it is empty
|
||||
# CMAKE_SYSTEM - ${CMAKE_SYSTEM}-${CMAKE_SYSTEM_VERSION}, for windows: ${CMAKE_SYSTEM}
|
||||
#
|
||||
# Expected uname -s output:
|
||||
#
|
||||
# AIX AIX
|
||||
# BSD/OS BSD/OS
|
||||
# FreeBSD FreeBSD
|
||||
# HP-UX HP-UX
|
||||
# Linux Linux
|
||||
# GNU/kFreeBSD GNU/kFreeBSD
|
||||
# NetBSD NetBSD
|
||||
# OpenBSD OpenBSD
|
||||
# OFS/1 (Digital Unix) OSF1
|
||||
# SCO OpenServer 5 SCO_SV
|
||||
# SCO UnixWare 7 UnixWare
|
||||
# SCO UnixWare (pre release 7) UNIX_SV
|
||||
# SCO XENIX Xenix
|
||||
# Solaris SunOS
|
||||
# SunOS SunOS
|
||||
# Tru64 Tru64
|
||||
# Ultrix ULTRIX
|
||||
# cygwin CYGWIN_NT-5.1
|
||||
# MacOSX Darwin
|
||||
|
||||
|
||||
# find out on which system cmake runs
|
||||
if(CMAKE_HOST_UNIX)
|
||||
find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
|
||||
if(CMAKE_UNAME)
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "AIX")
|
||||
exec_program(${CMAKE_UNAME} ARGS -v OUTPUT_VARIABLE _CMAKE_HOST_SYSTEM_MAJOR_VERSION)
|
||||
exec_program(${CMAKE_UNAME} ARGS -r OUTPUT_VARIABLE _CMAKE_HOST_SYSTEM_MINOR_VERSION)
|
||||
set(CMAKE_HOST_SYSTEM_VERSION "${_CMAKE_HOST_SYSTEM_MAJOR_VERSION}.${_CMAKE_HOST_SYSTEM_MINOR_VERSION}")
|
||||
unset(_CMAKE_HOST_SYSTEM_MAJOR_VERSION)
|
||||
unset(_CMAKE_HOST_SYSTEM_MINOR_VERSION)
|
||||
else()
|
||||
exec_program(${CMAKE_UNAME} ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
|
||||
endif()
|
||||
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|Darwin|^GNU$|Android")
|
||||
exec_program(${CMAKE_UNAME} ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
|
||||
RETURN_VALUE val)
|
||||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND
|
||||
CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "Power Macintosh")
|
||||
# OS X ppc 'uname -m' may report 'Power Macintosh' instead of 'powerpc'
|
||||
set(CMAKE_HOST_SYSTEM_PROCESSOR "powerpc")
|
||||
endif()
|
||||
elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "OpenBSD")
|
||||
exec_program(arch ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
|
||||
RETURN_VALUE val)
|
||||
else()
|
||||
exec_program(${CMAKE_UNAME} ARGS -p OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
|
||||
RETURN_VALUE val)
|
||||
if("${val}" GREATER 0)
|
||||
exec_program(${CMAKE_UNAME} ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
|
||||
RETURN_VALUE val)
|
||||
endif()
|
||||
endif()
|
||||
# check the return of the last uname -m or -p
|
||||
if("${val}" GREATER 0)
|
||||
set(CMAKE_HOST_SYSTEM_PROCESSOR "unknown")
|
||||
endif()
|
||||
set(CMAKE_UNAME ${CMAKE_UNAME} CACHE INTERNAL "uname command")
|
||||
# processor may have double quote in the name, and that needs to be removed
|
||||
string(REPLACE "\"" "" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
|
||||
string(REPLACE "/" "_" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_HOST_WIN32)
|
||||
if (DEFINED ENV{PROCESSOR_ARCHITEW6432})
|
||||
set (CMAKE_HOST_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITEW6432}")
|
||||
else()
|
||||
set (CMAKE_HOST_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# if a toolchain file is used, the user wants to cross compile.
|
||||
# in this case read the toolchain file and keep the CMAKE_HOST_SYSTEM_*
|
||||
# variables around so they can be used in CMakeLists.txt.
|
||||
# In all other cases, the host and target platform are the same.
|
||||
if(CMAKE_TOOLCHAIN_FILE)
|
||||
# at first try to load it as path relative to the directory from which cmake has been run
|
||||
include("${CMAKE_BINARY_DIR}/${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE)
|
||||
if(NOT _INCLUDED_TOOLCHAIN_FILE)
|
||||
# if the file isn't found there, check the default locations
|
||||
include("${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE)
|
||||
endif()
|
||||
|
||||
if(_INCLUDED_TOOLCHAIN_FILE)
|
||||
set(CMAKE_TOOLCHAIN_FILE "${_INCLUDED_TOOLCHAIN_FILE}" CACHE FILEPATH "The CMake toolchain file" FORCE)
|
||||
else()
|
||||
message(FATAL_ERROR "Could not find toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
|
||||
set(CMAKE_TOOLCHAIN_FILE "NOTFOUND" CACHE FILEPATH "The CMake toolchain file" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# if CMAKE_SYSTEM_NAME is here already set, either it comes from a toolchain file
|
||||
# or it was set via -DCMAKE_SYSTEM_NAME=...
|
||||
# if that's the case, assume we are crosscompiling
|
||||
if(CMAKE_SYSTEM_NAME)
|
||||
if(NOT DEFINED CMAKE_CROSSCOMPILING)
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
endif()
|
||||
set(PRESET_CMAKE_SYSTEM_NAME TRUE)
|
||||
elseif(CMAKE_VS_WINCE_VERSION)
|
||||
set(CMAKE_SYSTEM_NAME "WindowsCE")
|
||||
set(CMAKE_SYSTEM_VERSION "${CMAKE_VS_WINCE_VERSION}")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "${MSVC_C_ARCHITECTURE_ID}")
|
||||
set(CMAKE_CROSSCOMPILING TRUE)
|
||||
set(PRESET_CMAKE_SYSTEM_NAME TRUE)
|
||||
else()
|
||||
set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
|
||||
if(NOT DEFINED CMAKE_SYSTEM_VERSION)
|
||||
set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
|
||||
endif()
|
||||
set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}")
|
||||
set(CMAKE_CROSSCOMPILING FALSE)
|
||||
set(PRESET_CMAKE_SYSTEM_NAME FALSE)
|
||||
endif()
|
||||
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-Determine OPTIONAL)
|
||||
|
||||
macro(ADJUST_CMAKE_SYSTEM_VARIABLES _PREFIX)
|
||||
if(NOT ${_PREFIX}_NAME)
|
||||
set(${_PREFIX}_NAME "UnknownOS")
|
||||
endif()
|
||||
|
||||
# fix for BSD/OS , remove the /
|
||||
if(${_PREFIX}_NAME MATCHES BSD.OS)
|
||||
set(${_PREFIX}_NAME BSDOS)
|
||||
endif()
|
||||
|
||||
# fix for GNU/kFreeBSD, remove the GNU/
|
||||
if(${_PREFIX}_NAME MATCHES kFreeBSD)
|
||||
set(${_PREFIX}_NAME kFreeBSD)
|
||||
endif()
|
||||
|
||||
# fix for CYGWIN which has windows version in it
|
||||
if(${_PREFIX}_NAME MATCHES CYGWIN)
|
||||
set(${_PREFIX}_NAME CYGWIN)
|
||||
endif()
|
||||
|
||||
# set CMAKE_SYSTEM to the CMAKE_SYSTEM_NAME
|
||||
set(${_PREFIX} ${${_PREFIX}_NAME})
|
||||
# if there is a CMAKE_SYSTEM_VERSION then add a -${CMAKE_SYSTEM_VERSION}
|
||||
if(${_PREFIX}_VERSION)
|
||||
set(${_PREFIX} ${${_PREFIX}}-${${_PREFIX}_VERSION})
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
ADJUST_CMAKE_SYSTEM_VARIABLES(CMAKE_SYSTEM)
|
||||
ADJUST_CMAKE_SYSTEM_VARIABLES(CMAKE_HOST_SYSTEM)
|
||||
|
||||
# this file is also executed from cpack, then we don't need to generate these files
|
||||
# in this case there is no CMAKE_BINARY_DIR
|
||||
if(CMAKE_BINARY_DIR)
|
||||
# write entry to the log file
|
||||
if(PRESET_CMAKE_SYSTEM_NAME)
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"The target system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"The host system is: ${CMAKE_HOST_SYSTEM_NAME} - ${CMAKE_HOST_SYSTEM_VERSION} - ${CMAKE_HOST_SYSTEM_PROCESSOR}\n")
|
||||
else()
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"The system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n")
|
||||
endif()
|
||||
|
||||
# if a toolchain file is used, it needs to be included in the configured file,
|
||||
# so settings done there are also available if they don't go in the cache and in try_compile()
|
||||
set(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED)
|
||||
if(CMAKE_TOOLCHAIN_FILE)
|
||||
set(INCLUDE_CMAKE_TOOLCHAIN_FILE_IF_REQUIRED "include(\"${CMAKE_TOOLCHAIN_FILE}\")")
|
||||
endif()
|
||||
|
||||
# configure variables set in this file for fast reload, the template file is defined at the top of this file
|
||||
configure_file(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeSystem.cmake
|
||||
@ONLY)
|
||||
|
||||
endif()
|
|
@ -0,0 +1,174 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
CMakeDetermineVSServicePack
|
||||
---------------------------
|
||||
|
||||
.. deprecated:: 3.0
|
||||
|
||||
Do not use.
|
||||
|
||||
The functionality of this module has been superseded by the
|
||||
:variable:`CMAKE_<LANG>_COMPILER_VERSION` variable that contains
|
||||
the compiler version number.
|
||||
|
||||
Determine the Visual Studio service pack of the 'cl' in use.
|
||||
|
||||
Usage::
|
||||
|
||||
if(MSVC)
|
||||
include(CMakeDetermineVSServicePack)
|
||||
DetermineVSServicePack( my_service_pack )
|
||||
if( my_service_pack )
|
||||
message(STATUS "Detected: ${my_service_pack}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
Function DetermineVSServicePack sets the given variable to one of the
|
||||
following values or an empty string if unknown::
|
||||
|
||||
vc80, vc80sp1
|
||||
vc90, vc90sp1
|
||||
vc100, vc100sp1
|
||||
vc110, vc110sp1, vc110sp2, vc110sp3, vc110sp4
|
||||
#]=======================================================================]
|
||||
|
||||
if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.8)
|
||||
message(DEPRECATION
|
||||
"This module is deprecated and should not be used. "
|
||||
"Use the CMAKE_<LANG>_COMPILER_VERSION variable instead."
|
||||
)
|
||||
endif()
|
||||
|
||||
# [INTERNAL]
|
||||
# Please do not call this function directly
|
||||
function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version)
|
||||
if (${_cl_version} VERSION_EQUAL "14.00.50727.42")
|
||||
set(_version "vc80")
|
||||
elseif(${_cl_version} VERSION_EQUAL "14.00.50727.762")
|
||||
set(_version "vc80sp1")
|
||||
elseif(${_cl_version} VERSION_EQUAL "15.00.21022.08")
|
||||
set(_version "vc90")
|
||||
elseif(${_cl_version} VERSION_EQUAL "15.00.30729.01")
|
||||
set(_version "vc90sp1")
|
||||
elseif(${_cl_version} VERSION_EQUAL "16.00.30319.01")
|
||||
set(_version "vc100")
|
||||
elseif(${_cl_version} VERSION_EQUAL "16.00.40219.01")
|
||||
set(_version "vc100sp1")
|
||||
elseif(${_cl_version} VERSION_EQUAL "17.00.50727.1")
|
||||
set(_version "vc110")
|
||||
elseif(${_cl_version} VERSION_EQUAL "17.00.51106.1")
|
||||
set(_version "vc110sp1")
|
||||
elseif(${_cl_version} VERSION_EQUAL "17.00.60315.1")
|
||||
set(_version "vc110sp2")
|
||||
elseif(${_cl_version} VERSION_EQUAL "17.00.60610.1")
|
||||
set(_version "vc110sp3")
|
||||
elseif(${_cl_version} VERSION_EQUAL "17.00.61030")
|
||||
set(_version "vc110sp4")
|
||||
else()
|
||||
set(_version "")
|
||||
endif()
|
||||
set(${_OUT_VAR} ${_version} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
############################################################
|
||||
# [INTERNAL]
|
||||
# Please do not call this function directly
|
||||
function(_DetermineVSServicePack_FastCheckVersionWithCompiler _SUCCESS_VAR _VERSION_VAR)
|
||||
if(EXISTS ${CMAKE_CXX_COMPILER})
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_CXX_COMPILER} -?
|
||||
ERROR_VARIABLE _output
|
||||
OUTPUT_QUIET
|
||||
)
|
||||
|
||||
if(_output MATCHES "Compiler Version (([0-9]+)\\.([0-9]+)\\.([0-9]+)(\\.([0-9]+))?)")
|
||||
set(_cl_version ${CMAKE_MATCH_1})
|
||||
set(_major ${CMAKE_MATCH_2})
|
||||
set(_minor ${CMAKE_MATCH_3})
|
||||
if("${_major}${_minor}" STREQUAL "${MSVC_VERSION}")
|
||||
set(${_SUCCESS_VAR} true PARENT_SCOPE)
|
||||
set(${_VERSION_VAR} ${_cl_version} PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
############################################################
|
||||
# [INTERNAL]
|
||||
# Please do not call this function directly
|
||||
function(_DetermineVSServicePack_CheckVersionWithTryCompile _SUCCESS_VAR _VERSION_VAR)
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/return0.cc"
|
||||
"int main() { return 0; }\n")
|
||||
|
||||
try_compile(
|
||||
_CompileResult
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/return0.cc"
|
||||
OUTPUT_VARIABLE _output
|
||||
COPY_FILE "${CMAKE_BINARY_DIR}/return0.cc")
|
||||
|
||||
file(REMOVE "${CMAKE_BINARY_DIR}/return0.cc")
|
||||
|
||||
if(_output MATCHES "Compiler Version (([0-9]+)\\.([0-9]+)\\.([0-9]+)(\\.([0-9]+))?)")
|
||||
set(${_SUCCESS_VAR} true PARENT_SCOPE)
|
||||
set(${_VERSION_VAR} "${CMAKE_MATCH_1}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
############################################################
|
||||
# [INTERNAL]
|
||||
# Please do not call this function directly
|
||||
function(_DetermineVSServicePack_CheckVersionWithTryRun _SUCCESS_VAR _VERSION_VAR)
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/return0.cc"
|
||||
"#include <stdio.h>\n\nconst unsigned int CompilerVersion=_MSC_FULL_VER;\n\nint main(int argc, char* argv[])\n{\n int M( CompilerVersion/10000000);\n int m((CompilerVersion%10000000)/100000);\n int b(CompilerVersion%100000);\n\n printf(\"%d.%02d.%05d.01\",M,m,b);\n return 0;\n}\n")
|
||||
|
||||
try_run(
|
||||
_RunResult
|
||||
_CompileResult
|
||||
"${CMAKE_BINARY_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/return0.cc"
|
||||
RUN_OUTPUT_VARIABLE _runoutput
|
||||
)
|
||||
|
||||
file(REMOVE "${CMAKE_BINARY_DIR}/return0.cc")
|
||||
|
||||
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+.[0-9]+"
|
||||
_cl_version "${_runoutput}")
|
||||
|
||||
if(_cl_version)
|
||||
set(${_SUCCESS_VAR} true PARENT_SCOPE)
|
||||
set(${_VERSION_VAR} ${_cl_version} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
#
|
||||
# A function to call to determine the Visual Studio service pack
|
||||
# in use. See documentation above.
|
||||
function(DetermineVSServicePack _pack)
|
||||
if(NOT DETERMINED_VS_SERVICE_PACK OR NOT ${_pack})
|
||||
|
||||
_DetermineVSServicePack_FastCheckVersionWithCompiler(DETERMINED_VS_SERVICE_PACK _cl_version)
|
||||
if(NOT DETERMINED_VS_SERVICE_PACK)
|
||||
_DetermineVSServicePack_CheckVersionWithTryCompile(DETERMINED_VS_SERVICE_PACK _cl_version)
|
||||
if(NOT DETERMINED_VS_SERVICE_PACK)
|
||||
_DetermineVSServicePack_CheckVersionWithTryRun(DETERMINED_VS_SERVICE_PACK _cl_version)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(DETERMINED_VS_SERVICE_PACK)
|
||||
|
||||
if(_cl_version)
|
||||
# Call helper function to determine VS version
|
||||
_DetermineVSServicePackFromCompiler(_sp "${_cl_version}")
|
||||
if(_sp)
|
||||
set(${_pack} ${_sp} CACHE INTERNAL
|
||||
"The Visual Studio Release with Service Pack")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
|
@ -0,0 +1,148 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
CMakeExpandImportedTargets
|
||||
--------------------------
|
||||
|
||||
.. deprecated:: 3.4
|
||||
|
||||
Do not use.
|
||||
|
||||
This module was once needed to expand imported targets to the underlying
|
||||
libraries they reference on disk for use with the :command:`try_compile`
|
||||
and :command:`try_run` commands. These commands now support imported
|
||||
libraries in their ``LINK_LIBRARIES`` options (since CMake 2.8.11
|
||||
for :command:`try_compile` and since CMake 3.2 for :command:`try_run`).
|
||||
|
||||
This module does not support the policy :policy:`CMP0022` ``NEW``
|
||||
behavior or use of the :prop_tgt:`INTERFACE_LINK_LIBRARIES` property
|
||||
because :manual:`generator expressions <cmake-generator-expressions(7)>`
|
||||
cannot be evaluated during configuration.
|
||||
|
||||
::
|
||||
|
||||
CMAKE_EXPAND_IMPORTED_TARGETS(<var> LIBRARIES lib1 lib2...libN
|
||||
[CONFIGURATION <config>])
|
||||
|
||||
CMAKE_EXPAND_IMPORTED_TARGETS() takes a list of libraries and replaces
|
||||
all imported targets contained in this list with their actual file
|
||||
paths of the referenced libraries on disk, including the libraries
|
||||
from their link interfaces. If a CONFIGURATION is given, it uses the
|
||||
respective configuration of the imported targets if it exists. If no
|
||||
CONFIGURATION is given, it uses the first configuration from
|
||||
${CMAKE_CONFIGURATION_TYPES} if set, otherwise ${CMAKE_BUILD_TYPE}.
|
||||
|
||||
::
|
||||
|
||||
cmake_expand_imported_targets(expandedLibs
|
||||
LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
|
||||
CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}" )
|
||||
#]=======================================================================]
|
||||
|
||||
function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT )
|
||||
|
||||
set(options )
|
||||
set(oneValueArgs CONFIGURATION )
|
||||
set(multiValueArgs LIBRARIES )
|
||||
|
||||
cmake_parse_arguments(CEIT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(CEIT_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "Unknown keywords given to CMAKE_EXPAND_IMPORTED_TARGETS(): \"${CEIT_UNPARSED_ARGUMENTS}\"")
|
||||
endif()
|
||||
|
||||
if(NOT CEIT_CONFIGURATION)
|
||||
# Would be better to test GENERATOR_IS_MULTI_CONFIG global property,
|
||||
# but the documented behavior specifically says we check
|
||||
# CMAKE_CONFIGURATION_TYPES and fall back to CMAKE_BUILD_TYPE if no
|
||||
# config types are defined.
|
||||
if(CMAKE_CONFIGURATION_TYPES)
|
||||
list(GET CMAKE_CONFIGURATION_TYPES 0 CEIT_CONFIGURATION)
|
||||
else()
|
||||
set(CEIT_CONFIGURATION ${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# handle imported library targets
|
||||
|
||||
set(_CCSR_REQ_LIBS ${CEIT_LIBRARIES})
|
||||
|
||||
set(_CHECK_FOR_IMPORTED_TARGETS TRUE)
|
||||
set(_CCSR_LOOP_COUNTER 0)
|
||||
while(_CHECK_FOR_IMPORTED_TARGETS)
|
||||
math(EXPR _CCSR_LOOP_COUNTER "${_CCSR_LOOP_COUNTER} + 1 ")
|
||||
set(_CCSR_NEW_REQ_LIBS )
|
||||
set(_CHECK_FOR_IMPORTED_TARGETS FALSE)
|
||||
foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS})
|
||||
if(TARGET "${_CURRENT_LIB}")
|
||||
get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
|
||||
else()
|
||||
set(_importedConfigs "")
|
||||
endif()
|
||||
if (_importedConfigs)
|
||||
# message(STATUS "Detected imported target ${_CURRENT_LIB}")
|
||||
# Ok, so this is an imported target.
|
||||
# First we get the imported configurations.
|
||||
# Then we get the location of the actual library on disk of the first configuration.
|
||||
# then we'll get its link interface libraries property,
|
||||
# iterate through it and replace all imported targets we find there
|
||||
# with there actual location.
|
||||
|
||||
# guard against infinite loop: abort after 100 iterations ( 100 is arbitrary chosen)
|
||||
if ("${_CCSR_LOOP_COUNTER}" LESS 100)
|
||||
set(_CHECK_FOR_IMPORTED_TARGETS TRUE)
|
||||
# else ()
|
||||
# message(STATUS "********* aborting loop, counter : ${_CCSR_LOOP_COUNTER}")
|
||||
endif ()
|
||||
|
||||
# if one of the imported configurations equals ${CMAKE_TRY_COMPILE_CONFIGURATION},
|
||||
# use it, otherwise simply use the first one:
|
||||
list(FIND _importedConfigs "${CEIT_CONFIGURATION}" _configIndexToUse)
|
||||
if("${_configIndexToUse}" EQUAL -1)
|
||||
set(_configIndexToUse 0)
|
||||
endif()
|
||||
list(GET _importedConfigs ${_configIndexToUse} _importedConfigToUse)
|
||||
|
||||
get_target_property(_importedLocation "${_CURRENT_LIB}" IMPORTED_LOCATION_${_importedConfigToUse})
|
||||
get_target_property(_linkInterfaceLibs "${_CURRENT_LIB}" IMPORTED_LINK_INTERFACE_LIBRARIES_${_importedConfigToUse} )
|
||||
|
||||
list(APPEND _CCSR_NEW_REQ_LIBS "${_importedLocation}")
|
||||
# message(STATUS "Appending lib ${_CURRENT_LIB} as ${_importedLocation}")
|
||||
if(_linkInterfaceLibs)
|
||||
foreach(_currentLinkInterfaceLib ${_linkInterfaceLibs})
|
||||
# message(STATUS "Appending link interface lib ${_currentLinkInterfaceLib}")
|
||||
if(_currentLinkInterfaceLib)
|
||||
list(APPEND _CCSR_NEW_REQ_LIBS "${_currentLinkInterfaceLib}" )
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
else()
|
||||
# "Normal" libraries are just used as they are.
|
||||
list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" )
|
||||
# message(STATUS "Appending lib directly: ${_CURRENT_LIB}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(_CCSR_REQ_LIBS ${_CCSR_NEW_REQ_LIBS} )
|
||||
endwhile()
|
||||
|
||||
# Finally we iterate once more over all libraries. This loop only removes
|
||||
# all remaining imported target names (there shouldn't be any left anyway).
|
||||
set(_CCSR_NEW_REQ_LIBS )
|
||||
foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS})
|
||||
if(TARGET "${_CURRENT_LIB}")
|
||||
get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
|
||||
else()
|
||||
set(_importedConfigs "")
|
||||
endif()
|
||||
if (NOT _importedConfigs)
|
||||
list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" )
|
||||
# message(STATUS "final: appending ${_CURRENT_LIB}")
|
||||
# else ()
|
||||
# message(STATUS "final: skipping ${_CURRENT_LIB}")
|
||||
endif ()
|
||||
endforeach()
|
||||
# message(STATUS "setting -${_RESULT}- to -${_CCSR_NEW_REQ_LIBS}-")
|
||||
set(${_RESULT} "${_CCSR_NEW_REQ_LIBS}" PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
|
@ -0,0 +1,26 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This module is purposely no longer documented. It does nothing useful.
|
||||
if(NOT "${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS 2.7)
|
||||
message(FATAL_ERROR
|
||||
"The functionality of this module has been dropped as of CMake 2.8. "
|
||||
"It was deemed harmful (confusing users by changing their compiler). "
|
||||
"Please remove calls to the CMAKE_EXPORT_BUILD_SETTINGS macro and "
|
||||
"stop including this module. "
|
||||
"If this project generates any files for use by external projects, "
|
||||
"remove any use of the CMakeImportBuildSettings module from them.")
|
||||
endif()
|
||||
|
||||
# This macro used to store build settings of a project in a file to be
|
||||
# loaded by another project using CMAKE_IMPORT_BUILD_SETTINGS. Now it
|
||||
# creates a file that refuses to load (with comment explaining why).
|
||||
macro(CMAKE_EXPORT_BUILD_SETTINGS SETTINGS_FILE)
|
||||
if(NOT ${SETTINGS_FILE} STREQUAL "")
|
||||
configure_file(${CMAKE_ROOT}/Modules/CMakeBuildSettings.cmake.in
|
||||
${SETTINGS_FILE} @ONLY)
|
||||
else()
|
||||
message(SEND_ERROR "CMAKE_EXPORT_BUILD_SETTINGS called with no argument.")
|
||||
endif()
|
||||
endmacro()
|
|
@ -0,0 +1,114 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This file is included by CMakeFindEclipseCDT4.cmake and CMakeFindCodeBlocks.cmake
|
||||
|
||||
# The Eclipse and the CodeBlocks generators need to know the standard include path
|
||||
# so that they can find the headers at runtime and parsing etc. works better
|
||||
# This is done here by actually running gcc with the options so it prints its
|
||||
# system include directories, which are parsed then and stored in the cache.
|
||||
macro(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines)
|
||||
set(${_resultIncludeDirs})
|
||||
set(_gccOutput)
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n" )
|
||||
|
||||
if (${_lang} STREQUAL "c++")
|
||||
set(_compilerExecutable "${CMAKE_CXX_COMPILER}")
|
||||
set(_arg1 "${CMAKE_CXX_COMPILER_ARG1}")
|
||||
|
||||
if (CMAKE_CXX_FLAGS MATCHES "(-stdlib=[^ ]+)")
|
||||
set(_stdlib "${CMAKE_MATCH_1}")
|
||||
endif ()
|
||||
if (CMAKE_CXX_FLAGS MATCHES "(-std=[^ ]+)")
|
||||
set(_stdver "${CMAKE_MATCH_1}")
|
||||
endif ()
|
||||
else ()
|
||||
set(_compilerExecutable "${CMAKE_C_COMPILER}")
|
||||
set(_arg1 "${CMAKE_C_COMPILER_ARG1}")
|
||||
endif ()
|
||||
separate_arguments(_arg1 NATIVE_COMMAND "${_arg1}")
|
||||
execute_process(COMMAND ${_compilerExecutable} ${_arg1} ${_stdver} ${_stdlib} -v -E -x ${_lang} -dD dummy
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles
|
||||
ERROR_VARIABLE _gccOutput
|
||||
OUTPUT_VARIABLE _gccStdout )
|
||||
file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy")
|
||||
|
||||
# First find the system include dirs:
|
||||
if( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+ *\n) *End of (search) list" )
|
||||
|
||||
# split the output into lines and then remove leading and trailing spaces from each of them:
|
||||
string(REGEX MATCHALL "[^\n]+\n" _includeLines "${CMAKE_MATCH_1}")
|
||||
foreach(nextLine ${_includeLines})
|
||||
# on OSX, gcc says things like this: "/System/Library/Frameworks (framework directory)", strip the last part
|
||||
string(REGEX REPLACE "\\(framework directory\\)" "" nextLineNoFramework "${nextLine}")
|
||||
# strip spaces at the beginning and the end
|
||||
string(STRIP "${nextLineNoFramework}" _includePath)
|
||||
list(APPEND ${_resultIncludeDirs} "${_includePath}")
|
||||
endforeach()
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
# now find the builtin macros:
|
||||
string(REGEX MATCHALL "#define[^\n]+\n" _defineLines "${_gccStdout}")
|
||||
# A few example lines which the regexp below has to match properly:
|
||||
# #define MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
# #define __fastcall __attribute__((__fastcall__))
|
||||
# #define FOO (23)
|
||||
# #define __UINTMAX_TYPE__ long long unsigned int
|
||||
# #define __UINTMAX_TYPE__ long long unsigned int
|
||||
# #define __i386__ 1
|
||||
|
||||
foreach(nextLine ${_defineLines})
|
||||
string(REGEX MATCH "^#define +([A-Za-z_][A-Za-z0-9_]*)(\\([^\\)]+\\))? +(.+) *$" _dummy "${nextLine}")
|
||||
set(_name "${CMAKE_MATCH_1}${CMAKE_MATCH_2}")
|
||||
string(STRIP "${CMAKE_MATCH_3}" _value)
|
||||
#message(STATUS "m1: -${CMAKE_MATCH_1}- m2: -${CMAKE_MATCH_2}- m3: -${CMAKE_MATCH_3}-")
|
||||
|
||||
list(APPEND ${_resultDefines} "${_name}")
|
||||
if ("${_value}" STREQUAL "")
|
||||
list(APPEND ${_resultDefines} " ")
|
||||
else()
|
||||
list(APPEND ${_resultDefines} "${_value}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
endmacro()
|
||||
|
||||
# Save the current LC_ALL, LC_MESSAGES, and LANG environment variables and set them
|
||||
# to "C" that way GCC's "search starts here" text is in English and we can grok it.
|
||||
set(_orig_lc_all $ENV{LC_ALL})
|
||||
set(_orig_lc_messages $ENV{LC_MESSAGES})
|
||||
set(_orig_lang $ENV{LANG})
|
||||
|
||||
set(ENV{LC_ALL} C)
|
||||
set(ENV{LC_MESSAGES} C)
|
||||
set(ENV{LANG} C)
|
||||
|
||||
# Now check for C, works for gcc and Intel compiler at least
|
||||
if (NOT CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS)
|
||||
if (CMAKE_C_COMPILER_ID MATCHES GNU OR CMAKE_C_COMPILER_ID MATCHES Intel OR CMAKE_C_COMPILER_ID MATCHES Clang)
|
||||
_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c _dirs _defines)
|
||||
set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "C compiler system include directories")
|
||||
set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "C compiler system defined macros")
|
||||
elseif ("${CMAKE_C_COMPILER_ID}" MATCHES MSVC)
|
||||
set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "$ENV{INCLUDE}" CACHE INTERNAL "C compiler system include directories")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# And now the same for C++
|
||||
if (NOT CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS)
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Intel OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Clang)
|
||||
_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c++ _dirs _defines)
|
||||
set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "CXX compiler system include directories")
|
||||
set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "${_defines}" CACHE INTERNAL "CXX compiler system defined macros")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES MSVC)
|
||||
set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS "$ENV{INCLUDE}" CACHE INTERNAL "CXX compiler system include directories")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Restore original LC_ALL, LC_MESSAGES, and LANG
|
||||
set(ENV{LC_ALL} ${_orig_lc_all})
|
||||
set(ENV{LC_MESSAGES} ${_orig_lc_messages})
|
||||
set(ENV{LANG} ${_orig_lang})
|
|
@ -0,0 +1,157 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# search for additional tools required for C/C++ (and other languages ?)
|
||||
#
|
||||
# If the internal cmake variable _CMAKE_TOOLCHAIN_PREFIX is set, this is used
|
||||
# as prefix for the tools (e.g. arm-elf-gcc etc.)
|
||||
# If the cmake variable _CMAKE_TOOLCHAIN_LOCATION is set, the compiler is
|
||||
# searched only there. The other tools are at first searched there, then
|
||||
# also in the default locations.
|
||||
#
|
||||
# Sets the following variables:
|
||||
# CMAKE_AR
|
||||
# CMAKE_RANLIB
|
||||
# CMAKE_LINKER
|
||||
# CMAKE_MT
|
||||
# CMAKE_STRIP
|
||||
# CMAKE_INSTALL_NAME_TOOL
|
||||
|
||||
# on UNIX, cygwin and mingw
|
||||
|
||||
# Resolve full path of CMAKE_TOOL from user-defined name and SEARCH_PATH.
|
||||
function(__resolve_tool_path CMAKE_TOOL SEARCH_PATH DOCSTRING)
|
||||
|
||||
if(${CMAKE_TOOL})
|
||||
# We only get here if CMAKE_TOOL was
|
||||
# specified using -D or a pre-made CMakeCache.txt (e.g. via ctest)
|
||||
# or set in CMAKE_TOOLCHAIN_FILE.
|
||||
|
||||
get_filename_component(_CMAKE_USER_TOOL_PATH "${${CMAKE_TOOL}}" DIRECTORY)
|
||||
# Is CMAKE_TOOL a user-defined name instead of a full path?
|
||||
if(NOT _CMAKE_USER_TOOL_PATH)
|
||||
|
||||
# Find CMAKE_TOOL in the SEARCH_PATH directory by user-defined name.
|
||||
find_program(_CMAKE_TOOL_WITH_PATH NAMES ${${CMAKE_TOOL}} HINTS ${SEARCH_PATH})
|
||||
if(_CMAKE_TOOL_WITH_PATH)
|
||||
|
||||
# Overwrite CMAKE_TOOL with full path found in SEARCH_PATH.
|
||||
set(${CMAKE_TOOL} ${_CMAKE_TOOL_WITH_PATH} PARENT_SCOPE)
|
||||
|
||||
get_property(_CMAKE_TOOL_CACHED CACHE ${CMAKE_TOOL} PROPERTY TYPE)
|
||||
# If CMAKE_TOOL is present in the CMake Cache, then overwrit it as well.
|
||||
if(_CMAKE_TOOL_CACHED)
|
||||
set(${CMAKE_TOOL} "${_CMAKE_TOOL_WITH_PATH}" CACHE STRING ${DOCSTRING} FORCE)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
unset(_CMAKE_TOOL_WITH_PATH CACHE)
|
||||
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
__resolve_tool_path(CMAKE_LINKER "${_CMAKE_TOOLCHAIN_LOCATION}" "Default Linker")
|
||||
__resolve_tool_path(CMAKE_MT "${_CMAKE_TOOLCHAIN_LOCATION}" "Default Manifest Tool")
|
||||
|
||||
set(_CMAKE_TOOL_VARS "")
|
||||
|
||||
# if it's the MS C/CXX compiler, search for link
|
||||
if(("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_SIMULATE_ID}" STREQUAL "xMSVC" AND
|
||||
("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC"
|
||||
OR NOT "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xClang"))
|
||||
OR "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xMSVC"
|
||||
OR (CMAKE_HOST_WIN32 AND "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xPGI")
|
||||
OR (CMAKE_HOST_WIN32 AND "x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xNVIDIA")
|
||||
OR (CMAKE_GENERATOR MATCHES "Visual Studio"
|
||||
AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))
|
||||
|
||||
if("x${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL "xClang")
|
||||
find_program(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm llvm-nm HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
set(_CMAKE_ADDITIONAL_LINKER_NAMES "lld-link")
|
||||
endif()
|
||||
|
||||
find_program(CMAKE_LINKER NAMES ${_CMAKE_ADDITIONAL_LINKER_NAMES} link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
find_program(CMAKE_AR NAMES lib HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
find_program(CMAKE_MT NAMES mt HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
|
||||
list(APPEND _CMAKE_TOOL_VARS LINKER MT)
|
||||
|
||||
# in all other cases search for ar, ranlib, etc.
|
||||
else()
|
||||
if(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN)
|
||||
set(_CMAKE_TOOLCHAIN_LOCATION ${_CMAKE_TOOLCHAIN_LOCATION} ${CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN}/bin)
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN)
|
||||
set(_CMAKE_TOOLCHAIN_LOCATION ${_CMAKE_TOOLCHAIN_LOCATION} ${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}/bin)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ID}" STREQUAL Clang)
|
||||
set(_CMAKE_ADDITIONAL_AR_NAMES "llvm-ar")
|
||||
set(_CMAKE_ADDITIONAL_RANLIB_NAMES "llvm-ranlib")
|
||||
set(_CMAKE_ADDITIONAL_STRIP_NAMES "llvm-strip")
|
||||
set(_CMAKE_ADDITIONAL_LINKER_NAMES "ld.lld")
|
||||
set(_CMAKE_ADDITIONAL_NM_NAMES "llvm-nm")
|
||||
set(_CMAKE_ADDITIONAL_OBJDUMP_NAMES "llvm-objdump")
|
||||
set(_CMAKE_ADDITIONAL_OBJCOPY_NAMES "llvm-objcopy")
|
||||
set(_CMAKE_ADDITIONAL_READELF_NAMES "llvm-readelf")
|
||||
set(_CMAKE_ADDITIONAL_DLLTOOL_NAMES "llvm-dlltool")
|
||||
set(_CMAKE_ADDITIONAL_ADDR2LINE_NAMES "llvm-addr2line")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING AND NOT "${_CMAKE_TOOLCHAIN_PREFIX}" STREQUAL "")
|
||||
list(APPEND _CMAKE_ADDITIONAL_AR_NAMES "ar")
|
||||
list(APPEND _CMAKE_ADDITIONAL_RANLIB_NAMES "ranlib")
|
||||
list(APPEND _CMAKE_ADDITIONAL_STRIP_NAMES "strip")
|
||||
list(APPEND _CMAKE_ADDITIONAL_LINKER_NAMES "ld")
|
||||
list(APPEND _CMAKE_ADDITIONAL_NM_NAMES "nm")
|
||||
list(APPEND _CMAKE_ADDITIONAL_OBJDUMP_NAMES "objdump")
|
||||
list(APPEND _CMAKE_ADDITIONAL_OBJCOPY_NAMES "objcopy")
|
||||
list(APPEND _CMAKE_ADDITIONAL_READELF_NAMES "readelf")
|
||||
list(APPEND _CMAKE_ADDITIONAL_DLLTOOL_NAMES "dlltool")
|
||||
list(APPEND _CMAKE_ADDITIONAL_ADDR2LINE_NAMES "addr2line")
|
||||
endif()
|
||||
|
||||
find_program(CMAKE_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar${_CMAKE_TOOLCHAIN_SUFFIX} ${_CMAKE_ADDITIONAL_AR_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
|
||||
find_program(CMAKE_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib ${_CMAKE_ADDITIONAL_RANLIB_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
if(NOT CMAKE_RANLIB)
|
||||
set(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib")
|
||||
endif()
|
||||
|
||||
|
||||
find_program(CMAKE_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip${_CMAKE_TOOLCHAIN_SUFFIX} ${_CMAKE_ADDITIONAL_STRIP_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
find_program(CMAKE_LINKER NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ld ${_CMAKE_ADDITIONAL_LINKER_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
find_program(CMAKE_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm ${_CMAKE_ADDITIONAL_NM_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
find_program(CMAKE_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump ${_CMAKE_ADDITIONAL_OBJDUMP_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
find_program(CMAKE_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy ${_CMAKE_ADDITIONAL_OBJCOPY_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
find_program(CMAKE_READELF NAMES ${_CMAKE_TOOLCHAIN_PREFIX}readelf ${_CMAKE_ADDITIONAL_READELF_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
find_program(CMAKE_DLLTOOL NAMES ${_CMAKE_TOOLCHAIN_PREFIX}dlltool ${_CMAKE_ADDITIONAL_DLLTOOL_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
find_program(CMAKE_ADDR2LINE NAMES ${_CMAKE_TOOLCHAIN_PREFIX}addr2line ${_CMAKE_ADDITIONAL_ADDR2LINE_NAMES} HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
|
||||
list(APPEND _CMAKE_TOOL_VARS AR RANLIB STRIP LINKER NM OBJDUMP OBJCOPY READELF DLLTOOL ADDR2LINE)
|
||||
endif()
|
||||
|
||||
if(CMAKE_PLATFORM_HAS_INSTALLNAME)
|
||||
find_program(CMAKE_INSTALL_NAME_TOOL NAMES ${_CMAKE_TOOLCHAIN_PREFIX}install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
|
||||
if(NOT CMAKE_INSTALL_NAME_TOOL)
|
||||
message(FATAL_ERROR "Could not find install_name_tool, please check your installation.")
|
||||
endif()
|
||||
|
||||
list(APPEND _CMAKE_TOOL_VARS INSTALL_NAME_TOOL)
|
||||
endif()
|
||||
|
||||
# Mark any tool cache entries as advanced.
|
||||
foreach(var IN LISTS _CMAKE_TOOL_VARS)
|
||||
get_property(_CMAKE_TOOL_CACHED CACHE CMAKE_${var} PROPERTY TYPE)
|
||||
if(_CMAKE_TOOL_CACHED)
|
||||
mark_as_advanced(CMAKE_${var})
|
||||
endif()
|
||||
unset(_CMAKE_ADDITIONAL_${var}_NAMES)
|
||||
endforeach()
|
||||
unset(_CMAKE_TOOL_VARS)
|
||||
unset(_CMAKE_TOOL_CACHED)
|
|
@ -0,0 +1,33 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This file is included in CMakeSystemSpecificInformation.cmake if
|
||||
# the CodeBlocks extra generator has been selected.
|
||||
|
||||
find_program(CMAKE_CODEBLOCKS_EXECUTABLE NAMES codeblocks DOC "The CodeBlocks executable")
|
||||
|
||||
if(CMAKE_CODEBLOCKS_EXECUTABLE)
|
||||
set(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_CODEBLOCKS_EXECUTABLE} <PROJECT_FILE>" )
|
||||
endif()
|
||||
|
||||
# Determine builtin macros and include dirs:
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake)
|
||||
|
||||
# Try to find out how many CPUs we have and set the -j argument for make accordingly
|
||||
set(_CMAKE_CODEBLOCKS_INITIAL_MAKE_ARGS "")
|
||||
|
||||
include(ProcessorCount)
|
||||
processorcount(_CMAKE_CODEBLOCKS_PROCESSOR_COUNT)
|
||||
|
||||
# Only set -j if we are under UNIX and if the make-tool used actually has "make" in the name
|
||||
# (we may also get here in the future e.g. for ninja)
|
||||
if("${_CMAKE_CODEBLOCKS_PROCESSOR_COUNT}" GREATER 1 AND CMAKE_HOST_UNIX AND "${CMAKE_MAKE_PROGRAM}" MATCHES make)
|
||||
set(_CMAKE_CODEBLOCKS_INITIAL_MAKE_ARGS "-j${_CMAKE_CODEBLOCKS_PROCESSOR_COUNT}")
|
||||
endif()
|
||||
|
||||
# This variable is used by the CodeBlocks generator and appended to the make invocation commands.
|
||||
set(CMAKE_CODEBLOCKS_MAKE_ARGUMENTS "${_CMAKE_CODEBLOCKS_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when CodeBlocks invokes make. Enter e.g. -j<some_number> to get parallel builds")
|
||||
|
||||
# This variable is used by the CodeBlocks generator and allows the user to overwrite the autodetected CodeBlocks compiler id
|
||||
set(CMAKE_CODEBLOCKS_COMPILER_ID "" CACHE STRING "Id string of the compiler for the CodeBlocks IDE. Automatically detected when left empty")
|
|
@ -0,0 +1,63 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
CMakeFindDependencyMacro
|
||||
-------------------------
|
||||
|
||||
.. command:: find_dependency
|
||||
|
||||
The ``find_dependency()`` macro wraps a :command:`find_package` call for
|
||||
a package dependency::
|
||||
|
||||
find_dependency(<dep> [...])
|
||||
|
||||
It is designed to be used in a
|
||||
:ref:`Package Configuration File <Config File Packages>`
|
||||
(``<PackageName>Config.cmake``). ``find_dependency`` forwards the correct
|
||||
parameters for ``QUIET`` and ``REQUIRED`` which were passed to
|
||||
the original :command:`find_package` call. Any additional arguments
|
||||
specified are forwarded to :command:`find_package`.
|
||||
|
||||
If the dependency could not be found it sets an informative diagnostic
|
||||
message and calls :command:`return` to end processing of the calling
|
||||
package configuration file and return to the :command:`find_package`
|
||||
command that loaded it.
|
||||
|
||||
.. note::
|
||||
|
||||
The call to :command:`return` makes this macro unsuitable to call
|
||||
from :ref:`Find Modules`.
|
||||
#]=======================================================================]
|
||||
|
||||
macro(find_dependency dep)
|
||||
set(cmake_fd_quiet_arg)
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
|
||||
set(cmake_fd_quiet_arg QUIET)
|
||||
endif()
|
||||
set(cmake_fd_required_arg)
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
|
||||
set(cmake_fd_required_arg REQUIRED)
|
||||
endif()
|
||||
|
||||
get_property(cmake_fd_alreadyTransitive GLOBAL PROPERTY
|
||||
_CMAKE_${dep}_TRANSITIVE_DEPENDENCY
|
||||
)
|
||||
|
||||
find_package(${dep} ${ARGN}
|
||||
${cmake_fd_quiet_arg}
|
||||
${cmake_fd_required_arg}
|
||||
)
|
||||
|
||||
if(NOT DEFINED cmake_fd_alreadyTransitive OR cmake_fd_alreadyTransitive)
|
||||
set_property(GLOBAL PROPERTY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY TRUE)
|
||||
endif()
|
||||
|
||||
if (NOT ${dep}_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency ${dep} could not be found.")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
|
||||
return()
|
||||
endif()
|
||||
set(cmake_fd_required_arg)
|
||||
set(cmake_fd_quiet_arg)
|
||||
endmacro()
|
|
@ -0,0 +1,89 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This file is included in CMakeSystemSpecificInformation.cmake if
|
||||
# the Eclipse CDT4 extra generator has been selected.
|
||||
|
||||
find_program(CMAKE_ECLIPSE_EXECUTABLE NAMES eclipse DOC "The Eclipse executable")
|
||||
|
||||
function(_FIND_ECLIPSE_VERSION)
|
||||
# This code is in a function so the variables used here have only local scope
|
||||
|
||||
# Set up a map with the names of the Eclipse releases:
|
||||
set(_ECLIPSE_VERSION_NAME_ "Unknown" )
|
||||
set(_ECLIPSE_VERSION_NAME_3.2 "Callisto" )
|
||||
set(_ECLIPSE_VERSION_NAME_3.3 "Europa" )
|
||||
set(_ECLIPSE_VERSION_NAME_3.4 "Ganymede" )
|
||||
set(_ECLIPSE_VERSION_NAME_3.5 "Galileo" )
|
||||
set(_ECLIPSE_VERSION_NAME_3.6 "Helios" )
|
||||
set(_ECLIPSE_VERSION_NAME_3.7 "Indigo" )
|
||||
set(_ECLIPSE_VERSION_NAME_4.2 "Juno" )
|
||||
set(_ECLIPSE_VERSION_NAME_4.3 "Kepler" )
|
||||
set(_ECLIPSE_VERSION_NAME_4.4 "Luna" )
|
||||
set(_ECLIPSE_VERSION_NAME_4.5 "Mars" )
|
||||
|
||||
if(NOT DEFINED CMAKE_ECLIPSE_VERSION)
|
||||
if(CMAKE_ECLIPSE_EXECUTABLE)
|
||||
# use REALPATH to resolve symlinks (https://gitlab.kitware.com/cmake/cmake/-/issues/13036)
|
||||
get_filename_component(_REALPATH_CMAKE_ECLIPSE_EXECUTABLE "${CMAKE_ECLIPSE_EXECUTABLE}" REALPATH)
|
||||
get_filename_component(_ECLIPSE_DIR "${_REALPATH_CMAKE_ECLIPSE_EXECUTABLE}" PATH)
|
||||
file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/features/org.eclipse.platform*")
|
||||
if(APPLE AND NOT _ECLIPSE_FEATURE_DIR)
|
||||
file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/../../../features/org.eclipse.platform*")
|
||||
endif()
|
||||
if("${_ECLIPSE_FEATURE_DIR}" MATCHES ".+org.eclipse.platform_([0-9]+\\.[0-9]+).+")
|
||||
set(_ECLIPSE_VERSION ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(_ECLIPSE_VERSION)
|
||||
message(STATUS "Found Eclipse version ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})")
|
||||
else()
|
||||
set(_ECLIPSE_VERSION "3.6" )
|
||||
message(STATUS "Could not determine Eclipse version, assuming at least ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}}). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.")
|
||||
endif()
|
||||
|
||||
set(CMAKE_ECLIPSE_VERSION "${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})" CACHE STRING "The version of Eclipse. If Eclipse has not been found, 3.6 (Helios) is assumed.")
|
||||
else()
|
||||
message(STATUS "Eclipse version is set to ${CMAKE_ECLIPSE_VERSION}. Adjust CMAKE_ECLIPSE_VERSION if this is wrong.")
|
||||
endif()
|
||||
|
||||
set_property(CACHE CMAKE_ECLIPSE_VERSION PROPERTY STRINGS "3.2 (${_ECLIPSE_VERSION_NAME_3.2})"
|
||||
"3.3 (${_ECLIPSE_VERSION_NAME_3.3})"
|
||||
"3.4 (${_ECLIPSE_VERSION_NAME_3.4})"
|
||||
"3.5 (${_ECLIPSE_VERSION_NAME_3.5})"
|
||||
"3.6 (${_ECLIPSE_VERSION_NAME_3.6})"
|
||||
"3.7 (${_ECLIPSE_VERSION_NAME_3.7})"
|
||||
"4.2 (${_ECLIPSE_VERSION_NAME_4.2})"
|
||||
"4.3 (${_ECLIPSE_VERSION_NAME_4.3})"
|
||||
"4.4 (${_ECLIPSE_VERSION_NAME_4.4})"
|
||||
"4.5 (${_ECLIPSE_VERSION_NAME_4.5})"
|
||||
)
|
||||
endfunction()
|
||||
|
||||
_find_eclipse_version()
|
||||
|
||||
# Try to find out how many CPUs we have and set the -j argument for make accordingly
|
||||
set(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "")
|
||||
|
||||
include(ProcessorCount)
|
||||
processorcount(_CMAKE_ECLIPSE_PROCESSOR_COUNT)
|
||||
|
||||
# Only set -j if we are under UNIX and if the make-tool used actually has "make" in the name
|
||||
# (we may also get here in the future e.g. for ninja)
|
||||
if("${_CMAKE_ECLIPSE_PROCESSOR_COUNT}" GREATER 1 AND CMAKE_HOST_UNIX AND "${CMAKE_MAKE_PROGRAM}" MATCHES make)
|
||||
set(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "-j${_CMAKE_ECLIPSE_PROCESSOR_COUNT}")
|
||||
endif()
|
||||
|
||||
# This variable is used by the Eclipse generator and appended to the make invocation commands.
|
||||
set(CMAKE_ECLIPSE_MAKE_ARGUMENTS "${_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j<some_number> to get parallel builds")
|
||||
|
||||
set(CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES TRUE CACHE BOOL "If disabled, CMake will not generate linked resource to the subprojects and to the source files within targets")
|
||||
|
||||
# This variable is used by the Eclipse generator in out-of-source builds only.
|
||||
set(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR")
|
||||
mark_as_advanced(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT)
|
||||
|
||||
# Determine builtin macros and include dirs:
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake)
|
|
@ -0,0 +1,45 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
CMakeFindFrameworks
|
||||
-------------------
|
||||
|
||||
helper module to find OSX frameworks
|
||||
|
||||
This module reads hints about search locations from variables::
|
||||
|
||||
CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS - Extra directories
|
||||
#]=======================================================================]
|
||||
|
||||
if(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED)
|
||||
set(CMAKE_FIND_FRAMEWORKS_INCLUDED 1)
|
||||
macro(CMAKE_FIND_FRAMEWORKS fwk)
|
||||
set(${fwk}_FRAMEWORKS)
|
||||
if(APPLE)
|
||||
file(TO_CMAKE_PATH "$ENV{CMAKE_FRAMEWORK_PATH}" _cmff_CMAKE_FRAMEWORK_PATH)
|
||||
set(_cmff_search_paths
|
||||
${CMAKE_FRAMEWORK_PATH}
|
||||
${_cmff_CMAKE_FRAMEWORK_PATH}
|
||||
~/Library/Frameworks
|
||||
/usr/local/Frameworks
|
||||
/Library/Frameworks
|
||||
/System/Library/Frameworks
|
||||
/Network/Library/Frameworks
|
||||
${CMAKE_SYSTEM_FRAMEWORK_PATH})
|
||||
|
||||
# For backwards compatibility reasons,
|
||||
# CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS includes ${fwk}.framework
|
||||
list(TRANSFORM _cmff_search_paths APPEND /${fwk}.framework)
|
||||
list(APPEND _cmff_search_paths ${CMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS})
|
||||
|
||||
list(REMOVE_DUPLICATES _cmff_search_paths)
|
||||
|
||||
foreach(dir IN LISTS _cmff_search_paths)
|
||||
if(EXISTS ${dir})
|
||||
set(${fwk}_FRAMEWORKS ${${fwk}_FRAMEWORKS} ${dir})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endmacro()
|
||||
endif()
|
|
@ -0,0 +1,31 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# Do not include this module directly from code outside CMake!
|
||||
set(_JAVA_HOME "")
|
||||
if(JAVA_HOME AND IS_DIRECTORY "${JAVA_HOME}")
|
||||
set(_JAVA_HOME "${JAVA_HOME}")
|
||||
set(_JAVA_HOME_EXPLICIT 1)
|
||||
else()
|
||||
set(_ENV_JAVA_HOME "")
|
||||
if(DEFINED ENV{JAVA_HOME})
|
||||
file(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _ENV_JAVA_HOME)
|
||||
endif()
|
||||
if(_ENV_JAVA_HOME AND IS_DIRECTORY "${_ENV_JAVA_HOME}")
|
||||
set(_JAVA_HOME "${_ENV_JAVA_HOME}")
|
||||
set(_JAVA_HOME_EXPLICIT 1)
|
||||
else()
|
||||
set(_CMD_JAVA_HOME "")
|
||||
if(APPLE AND EXISTS /usr/libexec/java_home)
|
||||
execute_process(COMMAND /usr/libexec/java_home
|
||||
OUTPUT_VARIABLE _CMD_JAVA_HOME OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
if(_CMD_JAVA_HOME AND IS_DIRECTORY "${_CMD_JAVA_HOME}")
|
||||
set(_JAVA_HOME "${_CMD_JAVA_HOME}")
|
||||
set(_JAVA_HOME_EXPLICIT 0)
|
||||
endif()
|
||||
unset(_CMD_JAVA_HOME)
|
||||
endif()
|
||||
unset(_ENV_JAVA_HOME)
|
||||
endif()
|
|
@ -0,0 +1,21 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This file is included in CMakeSystemSpecificInformation.cmake if
|
||||
# the Eclipse CDT4 extra generator has been selected.
|
||||
|
||||
|
||||
# Try to find out how many CPUs we have and set the -j argument for make accordingly
|
||||
|
||||
include(ProcessorCount)
|
||||
processorcount(_CMAKE_KATE_PROCESSOR_COUNT)
|
||||
|
||||
# Only set -j if we are under UNIX and if the make-tool used actually has "make" in the name
|
||||
# (we may also get here in the future e.g. for ninja)
|
||||
if("${_CMAKE_KATE_PROCESSOR_COUNT}" GREATER 1 AND CMAKE_HOST_UNIX AND "${CMAKE_MAKE_PROGRAM}" MATCHES make)
|
||||
set(_CMAKE_KATE_INITIAL_MAKE_ARGS "-j${_CMAKE_KATE_PROCESSOR_COUNT}")
|
||||
endif()
|
||||
|
||||
# This variable is used by the Eclipse generator and appended to the make invocation commands.
|
||||
set(CMAKE_KATE_MAKE_ARGUMENTS "${_CMAKE_KATE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Kate invokes make. Enter e.g. -j<some_number> to get parallel builds")
|
|
@ -0,0 +1,204 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
CMakeFindPackageMode
|
||||
--------------------
|
||||
|
||||
|
||||
|
||||
This file is executed by cmake when invoked with --find-package. It
|
||||
expects that the following variables are set using -D:
|
||||
|
||||
``NAME``
|
||||
name of the package
|
||||
``COMPILER_ID``
|
||||
the CMake compiler ID for which the result is,
|
||||
i.e. GNU/Intel/Clang/MSVC, etc.
|
||||
``LANGUAGE``
|
||||
language for which the result will be used,
|
||||
i.e. C/CXX/Fortran/ASM
|
||||
``MODE``
|
||||
``EXIST``
|
||||
only check for existence of the given package
|
||||
``COMPILE``
|
||||
print the flags needed for compiling an object file which uses
|
||||
the given package
|
||||
``LINK``
|
||||
print the flags needed for linking when using the given package
|
||||
``QUIET``
|
||||
if TRUE, don't print anything
|
||||
#]=======================================================================]
|
||||
|
||||
if(NOT NAME)
|
||||
message(FATAL_ERROR "Name of the package to be searched not specified. Set the CMake variable NAME, e.g. -DNAME=JPEG .")
|
||||
endif()
|
||||
|
||||
if(NOT COMPILER_ID)
|
||||
message(FATAL_ERROR "COMPILER_ID argument not specified. In doubt, use GNU.")
|
||||
endif()
|
||||
|
||||
if(NOT LANGUAGE)
|
||||
message(FATAL_ERROR "LANGUAGE argument not specified. Use C, CXX or Fortran.")
|
||||
endif()
|
||||
|
||||
if(NOT MODE)
|
||||
message(FATAL_ERROR "MODE argument not specified. Use either EXIST, COMPILE or LINK.")
|
||||
endif()
|
||||
|
||||
# require the current version. If we don't do this, Platforms/CYGWIN.cmake complains because
|
||||
# it doesn't know whether it should set WIN32 or not:
|
||||
cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} )
|
||||
|
||||
macro(ENABLE_LANGUAGE)
|
||||
# disable the enable_language() command, otherwise --find-package breaks on Windows.
|
||||
# On Windows, enable_language(RC) is called in the platform files unconditionally.
|
||||
# But in --find-package mode, we don't want (and can't) enable any language.
|
||||
endmacro()
|
||||
|
||||
set(CMAKE_PLATFORM_INFO_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
|
||||
|
||||
include(CMakeDetermineSystem)
|
||||
|
||||
# short-cut some tests on Darwin, see Darwin-GNU.cmake:
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin AND "${COMPILER_ID}" MATCHES GNU)
|
||||
set(CMAKE_${LANGUAGE}_SYSROOT_FLAG "")
|
||||
set(CMAKE_${LANGUAGE}_OSX_DEPLOYMENT_TARGET_FLAG "")
|
||||
endif()
|
||||
|
||||
include(CMakeSystemSpecificInitialize)
|
||||
|
||||
# Also load the system specific file, which sets up e.g. the search paths.
|
||||
# This makes the FIND_XXX() calls work much better
|
||||
include(CMakeSystemSpecificInformation)
|
||||
|
||||
if(UNIX)
|
||||
|
||||
# try to guess whether we have a 64bit system, if it has not been set
|
||||
# from the outside
|
||||
if(NOT CMAKE_SIZEOF_VOID_P)
|
||||
set(CMAKE_SIZEOF_VOID_P 4)
|
||||
if(EXISTS /usr/lib64)
|
||||
set(CMAKE_SIZEOF_VOID_P 8)
|
||||
else()
|
||||
# use the file utility to check whether itself is 64 bit:
|
||||
find_program(FILE_EXECUTABLE file)
|
||||
if(FILE_EXECUTABLE)
|
||||
get_filename_component(FILE_ABSPATH "${FILE_EXECUTABLE}" ABSOLUTE)
|
||||
execute_process(COMMAND "${FILE_ABSPATH}" "${FILE_ABSPATH}" OUTPUT_VARIABLE fileOutput ERROR_QUIET)
|
||||
if("${fileOutput}" MATCHES "64-bit")
|
||||
set(CMAKE_SIZEOF_VOID_P 8)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# guess Debian multiarch if it has not been set:
|
||||
if(EXISTS /etc/debian_version)
|
||||
if(NOT CMAKE_${LANGUAGE}_LIBRARY_ARCHITECTURE )
|
||||
file(GLOB filesInLib RELATIVE /lib /lib/*-linux-gnu* )
|
||||
foreach(file ${filesInLib})
|
||||
if("${file}" MATCHES "${CMAKE_LIBRARY_ARCHITECTURE_REGEX}")
|
||||
set(CMAKE_${LANGUAGE}_LIBRARY_ARCHITECTURE ${file})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
if(NOT CMAKE_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE ${CMAKE_${LANGUAGE}_LIBRARY_ARCHITECTURE})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
set(CMAKE_${LANGUAGE}_COMPILER "dummy")
|
||||
set(CMAKE_${LANGUAGE}_COMPILER_ID "${COMPILER_ID}")
|
||||
include(CMake${LANGUAGE}Information)
|
||||
|
||||
|
||||
function(set_compile_flags_var _packageName)
|
||||
string(TOUPPER "${_packageName}" PACKAGE_NAME)
|
||||
# Check the following variables:
|
||||
# FOO_INCLUDE_DIRS
|
||||
# Foo_INCLUDE_DIRS
|
||||
# FOO_INCLUDES
|
||||
# Foo_INCLUDES
|
||||
# FOO_INCLUDE_DIR
|
||||
# Foo_INCLUDE_DIR
|
||||
set(includes)
|
||||
if(DEFINED ${_packageName}_INCLUDE_DIRS)
|
||||
set(includes ${_packageName}_INCLUDE_DIRS)
|
||||
elseif(DEFINED ${PACKAGE_NAME}_INCLUDE_DIRS)
|
||||
set(includes ${PACKAGE_NAME}_INCLUDE_DIRS)
|
||||
elseif(DEFINED ${_packageName}_INCLUDES)
|
||||
set(includes ${_packageName}_INCLUDES)
|
||||
elseif(DEFINED ${PACKAGE_NAME}_INCLUDES)
|
||||
set(includes ${PACKAGE_NAME}_INCLUDES)
|
||||
elseif(DEFINED ${_packageName}_INCLUDE_DIR)
|
||||
set(includes ${_packageName}_INCLUDE_DIR)
|
||||
elseif(DEFINED ${PACKAGE_NAME}_INCLUDE_DIR)
|
||||
set(includes ${PACKAGE_NAME}_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
set(PACKAGE_INCLUDE_DIRS "${${includes}}" PARENT_SCOPE)
|
||||
|
||||
# Check the following variables:
|
||||
# FOO_DEFINITIONS
|
||||
# Foo_DEFINITIONS
|
||||
set(definitions)
|
||||
if(DEFINED ${_packageName}_DEFINITIONS)
|
||||
set(definitions ${_packageName}_DEFINITIONS)
|
||||
elseif(DEFINED ${PACKAGE_NAME}_DEFINITIONS)
|
||||
set(definitions ${PACKAGE_NAME}_DEFINITIONS)
|
||||
endif()
|
||||
|
||||
set(PACKAGE_DEFINITIONS "${${definitions}}" )
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
function(set_link_flags_var _packageName)
|
||||
string(TOUPPER "${_packageName}" PACKAGE_NAME)
|
||||
# Check the following variables:
|
||||
# FOO_LIBRARIES
|
||||
# Foo_LIBRARIES
|
||||
# FOO_LIBS
|
||||
# Foo_LIBS
|
||||
set(libs)
|
||||
if(DEFINED ${_packageName}_LIBRARIES)
|
||||
set(libs ${_packageName}_LIBRARIES)
|
||||
elseif(DEFINED ${PACKAGE_NAME}_LIBRARIES)
|
||||
set(libs ${PACKAGE_NAME}_LIBRARIES)
|
||||
elseif(DEFINED ${_packageName}_LIBS)
|
||||
set(libs ${_packageName}_LIBS)
|
||||
elseif(DEFINED ${PACKAGE_NAME}_LIBS)
|
||||
set(libs ${PACKAGE_NAME}_LIBS)
|
||||
endif()
|
||||
|
||||
set(PACKAGE_LIBRARIES "${${libs}}" PARENT_SCOPE )
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
find_package("${NAME}" QUIET)
|
||||
|
||||
set(PACKAGE_FOUND FALSE)
|
||||
|
||||
string(TOUPPER "${NAME}" UPPERCASE_NAME)
|
||||
|
||||
if(${NAME}_FOUND OR ${UPPERCASE_NAME}_FOUND)
|
||||
set(PACKAGE_FOUND TRUE)
|
||||
|
||||
if("${MODE}" STREQUAL "EXIST")
|
||||
# do nothing
|
||||
elseif("${MODE}" STREQUAL "COMPILE")
|
||||
set_compile_flags_var(${NAME})
|
||||
elseif("${MODE}" STREQUAL "LINK")
|
||||
set_link_flags_var(${NAME})
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid mode argument ${MODE} given.")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
set(PACKAGE_QUIET ${SILENT} )
|
|
@ -0,0 +1,23 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This file is included in CMakeSystemSpecificInformation.cmake if
|
||||
# the Sublime Text 2 extra generator has been selected.
|
||||
|
||||
find_program(CMAKE_SUBLIMETEXT_EXECUTABLE
|
||||
NAMES subl3 subl sublime_text
|
||||
PATHS
|
||||
"/Applications/Sublime Text.app/Contents/SharedSupport/bin"
|
||||
"/Applications/Sublime Text 3.app/Contents/SharedSupport/bin"
|
||||
"/Applications/Sublime Text 2.app/Contents/SharedSupport/bin"
|
||||
"$ENV{HOME}/Applications/Sublime Text.app/Contents/SharedSupport/bin"
|
||||
"$ENV{HOME}/Applications/Sublime Text 3.app/Contents/SharedSupport/bin"
|
||||
"$ENV{HOME}/Applications/Sublime Text 2.app/Contents/SharedSupport/bin"
|
||||
"/opt/sublime_text"
|
||||
"/opt/sublime_text_3"
|
||||
DOC "The Sublime Text executable")
|
||||
|
||||
if(CMAKE_SUBLIMETEXT_EXECUTABLE)
|
||||
set(CMAKE_OPEN_PROJECT_COMMAND "${CMAKE_SUBLIMETEXT_EXECUTABLE} --project <PROJECT_FILE>" )
|
||||
endif()
|
|
@ -0,0 +1,7 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
set (CMAKE_MAKE_PROGRAM "wmake" CACHE STRING
|
||||
"Program used to build from makefiles.")
|
||||
mark_as_advanced(CMAKE_MAKE_PROGRAM)
|
|
@ -0,0 +1,6 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# Empty placeholder for input dependencies in existing
|
||||
# build trees produced by older versions of CMake.
|
|
@ -0,0 +1,114 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
CMakeForceCompiler
|
||||
------------------
|
||||
|
||||
.. deprecated:: 3.6
|
||||
|
||||
Do not use.
|
||||
|
||||
The macros provided by this module were once intended for use by
|
||||
cross-compiling toolchain files when CMake was not able to automatically
|
||||
detect the compiler identification. Since the introduction of this module,
|
||||
CMake's compiler identification capabilities have improved and can now be
|
||||
taught to recognize any compiler. Furthermore, the suite of information
|
||||
CMake detects from a compiler is now too extensive to be provided by
|
||||
toolchain files using these macros.
|
||||
|
||||
One common use case for this module was to skip CMake's checks for a
|
||||
working compiler when using a cross-compiler that cannot link binaries
|
||||
without special flags or custom linker scripts. This case is now supported
|
||||
by setting the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable in the
|
||||
toolchain file instead.
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
Macro ``CMAKE_FORCE_C_COMPILER`` has the following signature:
|
||||
|
||||
::
|
||||
|
||||
CMAKE_FORCE_C_COMPILER(<compiler> <compiler-id>)
|
||||
|
||||
It sets :variable:`CMAKE_C_COMPILER <CMAKE_<LANG>_COMPILER>` to
|
||||
the given compiler and the cmake internal variable
|
||||
:variable:`CMAKE_C_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` to the given
|
||||
compiler-id. It also bypasses the check for working compiler and basic
|
||||
compiler information tests.
|
||||
|
||||
Macro ``CMAKE_FORCE_CXX_COMPILER`` has the following signature:
|
||||
|
||||
::
|
||||
|
||||
CMAKE_FORCE_CXX_COMPILER(<compiler> <compiler-id>)
|
||||
|
||||
It sets :variable:`CMAKE_CXX_COMPILER <CMAKE_<LANG>_COMPILER>` to
|
||||
the given compiler and the cmake internal variable
|
||||
:variable:`CMAKE_CXX_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` to the given
|
||||
compiler-id. It also bypasses the check for working compiler and basic
|
||||
compiler information tests.
|
||||
|
||||
Macro ``CMAKE_FORCE_Fortran_COMPILER`` has the following signature:
|
||||
|
||||
::
|
||||
|
||||
CMAKE_FORCE_Fortran_COMPILER(<compiler> <compiler-id>)
|
||||
|
||||
It sets :variable:`CMAKE_Fortran_COMPILER <CMAKE_<LANG>_COMPILER>` to
|
||||
the given compiler and the cmake internal variable
|
||||
:variable:`CMAKE_Fortran_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` to the given
|
||||
compiler-id. It also bypasses the check for working compiler and basic
|
||||
compiler information tests.
|
||||
|
||||
So a simple toolchain file could look like this:
|
||||
|
||||
::
|
||||
|
||||
include (CMakeForceCompiler)
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
CMAKE_FORCE_C_COMPILER (chc12 MetrowerksHicross)
|
||||
CMAKE_FORCE_CXX_COMPILER (chc12 MetrowerksHicross)
|
||||
#]=======================================================================]
|
||||
|
||||
macro(CMAKE_FORCE_C_COMPILER compiler id)
|
||||
message(DEPRECATION "The CMAKE_FORCE_C_COMPILER macro is deprecated. "
|
||||
"Instead just set CMAKE_C_COMPILER and allow CMake to identify the compiler.")
|
||||
set(CMAKE_C_COMPILER "${compiler}")
|
||||
set(CMAKE_C_COMPILER_ID_RUN TRUE)
|
||||
set(CMAKE_C_COMPILER_ID ${id})
|
||||
set(CMAKE_C_COMPILER_FORCED TRUE)
|
||||
|
||||
# Set old compiler id variables.
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
||||
set(CMAKE_COMPILER_IS_GNUCC 1)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(CMAKE_FORCE_CXX_COMPILER compiler id)
|
||||
message(DEPRECATION "The CMAKE_FORCE_CXX_COMPILER macro is deprecated. "
|
||||
"Instead just set CMAKE_CXX_COMPILER and allow CMake to identify the compiler.")
|
||||
set(CMAKE_CXX_COMPILER "${compiler}")
|
||||
set(CMAKE_CXX_COMPILER_ID_RUN TRUE)
|
||||
set(CMAKE_CXX_COMPILER_ID ${id})
|
||||
set(CMAKE_CXX_COMPILER_FORCED TRUE)
|
||||
|
||||
# Set old compiler id variables.
|
||||
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
||||
set(CMAKE_COMPILER_IS_GNUCXX 1)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(CMAKE_FORCE_Fortran_COMPILER compiler id)
|
||||
message(DEPRECATION "The CMAKE_FORCE_Fortran_COMPILER macro is deprecated. "
|
||||
"Instead just set CMAKE_Fortran_COMPILER and allow CMake to identify the compiler.")
|
||||
set(CMAKE_Fortran_COMPILER "${compiler}")
|
||||
set(CMAKE_Fortran_COMPILER_ID_RUN TRUE)
|
||||
set(CMAKE_Fortran_COMPILER_ID ${id})
|
||||
set(CMAKE_Fortran_COMPILER_FORCED TRUE)
|
||||
|
||||
# Set old compiler id variables.
|
||||
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
|
||||
set(CMAKE_COMPILER_IS_GNUG77 1)
|
||||
endif()
|
||||
endmacro()
|
|
@ -0,0 +1,69 @@
|
|||
set(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@")
|
||||
set(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@")
|
||||
set(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@")
|
||||
set(CMAKE_Fortran_COMPILER_VERSION "@CMAKE_Fortran_COMPILER_VERSION@")
|
||||
set(CMAKE_Fortran_COMPILER_WRAPPER "@CMAKE_Fortran_COMPILER_WRAPPER@")
|
||||
set(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@")
|
||||
set(CMAKE_Fortran_SIMULATE_ID "@CMAKE_Fortran_SIMULATE_ID@")
|
||||
set(CMAKE_Fortran_SIMULATE_VERSION "@CMAKE_Fortran_SIMULATE_VERSION@")
|
||||
@_SET_CMAKE_Fortran_XL_CPP@
|
||||
@_SET_CMAKE_Fortran_COMPILER_ARCHITECTURE_ID@
|
||||
@_SET_CMAKE_Fortran_COMPILER_SYSROOT@
|
||||
@SET_MSVC_Fortran_ARCHITECTURE_ID@
|
||||
set(CMAKE_AR "@CMAKE_AR@")
|
||||
set(CMAKE_Fortran_COMPILER_AR "@CMAKE_Fortran_COMPILER_AR@")
|
||||
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
|
||||
set(CMAKE_Fortran_COMPILER_RANLIB "@CMAKE_Fortran_COMPILER_RANLIB@")
|
||||
set(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@)
|
||||
set(CMAKE_Fortran_COMPILER_LOADED 1)
|
||||
set(CMAKE_Fortran_COMPILER_WORKS @CMAKE_Fortran_COMPILER_WORKS@)
|
||||
set(CMAKE_Fortran_ABI_COMPILED @CMAKE_Fortran_ABI_COMPILED@)
|
||||
set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@)
|
||||
set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@)
|
||||
if(CMAKE_COMPILER_IS_CYGWIN)
|
||||
set(CYGWIN 1)
|
||||
set(UNIX 1)
|
||||
endif()
|
||||
|
||||
set(CMAKE_Fortran_COMPILER_ENV_VAR "FC")
|
||||
|
||||
set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 @CMAKE_Fortran_COMPILER_SUPPORTS_F90@)
|
||||
|
||||
if(CMAKE_COMPILER_IS_MINGW)
|
||||
set(MINGW 1)
|
||||
endif()
|
||||
set(CMAKE_Fortran_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_Fortran_SOURCE_FILE_EXTENSIONS f;F;fpp;FPP;f77;F77;f90;F90;for;For;FOR;f95;F95)
|
||||
set(CMAKE_Fortran_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||
set(CMAKE_Fortran_LINKER_PREFERENCE 20)
|
||||
if(UNIX)
|
||||
set(CMAKE_Fortran_OUTPUT_EXTENSION .o)
|
||||
else()
|
||||
set(CMAKE_Fortran_OUTPUT_EXTENSION .obj)
|
||||
endif()
|
||||
|
||||
# Save compiler ABI information.
|
||||
set(CMAKE_Fortran_SIZEOF_DATA_PTR "@CMAKE_Fortran_SIZEOF_DATA_PTR@")
|
||||
set(CMAKE_Fortran_COMPILER_ABI "@CMAKE_Fortran_COMPILER_ABI@")
|
||||
set(CMAKE_Fortran_LIBRARY_ARCHITECTURE "@CMAKE_Fortran_LIBRARY_ARCHITECTURE@")
|
||||
|
||||
if(CMAKE_Fortran_SIZEOF_DATA_PTR AND NOT CMAKE_SIZEOF_VOID_P)
|
||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_Fortran_SIZEOF_DATA_PTR}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_Fortran_COMPILER_ABI)
|
||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_Fortran_COMPILER_ABI}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_Fortran_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_Fortran_LIBRARY_ARCHITECTURE@")
|
||||
endif()
|
||||
|
||||
@CMAKE_Fortran_COMPILER_CUSTOM_CODE@
|
||||
@CMAKE_Fortran_SYSROOT_FLAG_CODE@
|
||||
@CMAKE_Fortran_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
|
||||
|
||||
set(CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_INCLUDE_DIRECTORIES@")
|
||||
set(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "@CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES@")
|
||||
set(CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES@")
|
||||
set(CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
|
|
@ -0,0 +1,40 @@
|
|||
PROGRAM CMakeFortranCompilerABI
|
||||
#if 0
|
||||
! Address Size
|
||||
#endif
|
||||
#if defined(_LP64)
|
||||
PRINT *, 'INFO:sizeof_dptr[8]'
|
||||
#elif defined(_M_IA64)
|
||||
PRINT *, 'INFO:sizeof_dptr[8]'
|
||||
#elif defined(_M_X64)
|
||||
PRINT *, 'INFO:sizeof_dptr[8]'
|
||||
#elif defined(_M_AMD64)
|
||||
PRINT *, 'INFO:sizeof_dptr[8]'
|
||||
#elif defined(__x86_64__)
|
||||
PRINT *, 'INFO:sizeof_dptr[8]'
|
||||
|
||||
#elif defined(_ILP32)
|
||||
PRINT *, 'INFO:sizeof_dptr[4]'
|
||||
#elif defined(_M_IX86)
|
||||
PRINT *, 'INFO:sizeof_dptr[4]'
|
||||
#elif defined(__i386__)
|
||||
PRINT *, 'INFO:sizeof_dptr[4]'
|
||||
|
||||
#elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 8
|
||||
PRINT *, 'INFO:sizeof_dptr[8]'
|
||||
#elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 4
|
||||
PRINT *, 'INFO:sizeof_dptr[4]'
|
||||
#elif defined(__SIZEOF_SIZE_T__) && __SIZEOF_SIZE_T__ == 8
|
||||
PRINT *, 'INFO:sizeof_dptr[8]'
|
||||
#elif defined(__SIZEOF_SIZE_T__) && __SIZEOF_SIZE_T__ == 4
|
||||
PRINT *, 'INFO:sizeof_dptr[4]'
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
! Application Binary Interface
|
||||
#endif
|
||||
#if defined(__ELF__)
|
||||
PRINT *, 'INFO:abi[ELF]'
|
||||
#endif
|
||||
PRINT *, 'ABI Detection'
|
||||
END
|
|
@ -0,0 +1,200 @@
|
|||
PROGRAM CMakeFortranCompilerId
|
||||
#if 0
|
||||
! Identify the compiler
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
PRINT *, 'INFO:simulate[MSVC]'
|
||||
# if _MSC_VER >= 1900
|
||||
PRINT *, 'INFO:simulate_version[019.00]'
|
||||
# elif _MSC_VER >= 1800
|
||||
PRINT *, 'INFO:simulate_version[018.00]'
|
||||
# elif _MSC_VER >= 1700
|
||||
PRINT *, 'INFO:simulate_version[017.00]'
|
||||
# elif _MSC_VER >= 1600
|
||||
PRINT *, 'INFO:simulate_version[016.00]'
|
||||
# elif _MSC_VER >= 1500
|
||||
PRINT *, 'INFO:simulate_version[015.00]'
|
||||
# elif _MSC_VER >= 1400
|
||||
PRINT *, 'INFO:simulate_version[014.00]'
|
||||
# elif _MSC_VER >= 1310
|
||||
PRINT *, 'INFO:simulate_version[013.01]'
|
||||
# else
|
||||
PRINT *, 'INFO:simulate_version[013.00]'
|
||||
# endif
|
||||
#endif
|
||||
#if defined(__INTEL_COMPILER) || defined(__ICC)
|
||||
PRINT *, 'INFO:compiler[Intel]'
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
|
||||
# if defined(__INTEL_COMPILER_UPDATE)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
|
||||
# else
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
|
||||
# endif
|
||||
# if defined(__INTEL_COMPILER_BUILD_DATE)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
|
||||
# endif
|
||||
#elif defined(__SUNPRO_F95)
|
||||
PRINT *, 'INFO:compiler[SunPro]'
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_F95>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_F95>>4 & 0xF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_F95 & 0xF)
|
||||
#elif defined(__SUNPRO_F90)
|
||||
PRINT *, 'INFO:compiler[SunPro]'
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_F90>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_F90>>4 & 0xF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_F90 & 0xF)
|
||||
#elif defined(_CRAYFTN)
|
||||
PRINT *, 'INFO:compiler[Cray]'
|
||||
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
|
||||
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
|
||||
#elif defined(__G95__)
|
||||
PRINT *, 'INFO:compiler[G95]'
|
||||
# define COMPILER_VERSION_MAJOR DEC(__G95__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__G95_MINOR__)
|
||||
#elif defined(__PATHSCALE__)
|
||||
PRINT *, 'INFO:compiler[PathScale]'
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
|
||||
# if defined(__PATHCC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
|
||||
# endif
|
||||
#elif defined(__ABSOFT__)
|
||||
PRINT *, 'INFO:compiler[Absoft]'
|
||||
#elif defined(__GNUC__)
|
||||
PRINT *, 'INFO:compiler[GNU]'
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
#elif defined(__IBMC__)
|
||||
# if defined(__COMPILER_VER__)
|
||||
PRINT *, 'INFO:compiler[zOS]'
|
||||
# elif __IBMC__ >= 800
|
||||
PRINT *, 'INFO:compiler[XL]'
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
# else
|
||||
PRINT *, 'INFO:compiler[VisualAge]'
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
# endif
|
||||
#elif defined(__PGI)
|
||||
PRINT *, 'INFO:compiler[PGI]'
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
|
||||
# if defined(__PGIC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
|
||||
# endif
|
||||
#elif defined(__FLANG)
|
||||
PRINT *, 'INFO:compiler[Flang]'
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FLANG_MAJOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FLANG_MINOR__)
|
||||
# if defined(__FLANG_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FLANG_PATCHLEVEL__)
|
||||
# endif
|
||||
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
|
||||
PRINT *, 'INFO:compiler[VisualAge]'
|
||||
#elif defined(__hpux) || defined(__hpux__)
|
||||
PRINT *, 'INFO:compiler[HP]'
|
||||
#elif defined(NAGFOR)
|
||||
PRINT *, 'INFO:compiler[NAG]'
|
||||
#define COMPILER_VERSION_MAJOR DEC(__NAG_COMPILER_RELEASE/10)
|
||||
#define COMPILER_VERSION_MINOR DEC(__NAG_COMPILER_RELEASE % 10)
|
||||
#define COMPILER_VERSION_PATCH DEC(__NAG_COMPILER_BUILD)
|
||||
#else
|
||||
PRINT *, 'INFO:compiler[]'
|
||||
#endif
|
||||
#if defined(__CRAYXE) || defined(__CRAYXC)
|
||||
PRINT *, 'INFO:compiler_wrapper[CrayPrgEnv]'
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
! Identify the platform
|
||||
#endif
|
||||
#if defined(__linux) || defined(__linux__) || defined(linux)
|
||||
PRINT *, 'INFO:platform[Linux]'
|
||||
#elif defined(__CYGWIN__)
|
||||
PRINT *, 'INFO:platform[Cygwin]'
|
||||
#elif defined(__MINGW32__)
|
||||
PRINT *, 'INFO:platform[MinGW]'
|
||||
#elif defined(__APPLE__)
|
||||
PRINT *, 'INFO:platform[Darwin]'
|
||||
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
PRINT *, 'INFO:platform[Windows]'
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD)
|
||||
PRINT *, 'INFO:platform[FreeBSD]'
|
||||
#elif defined(__NetBSD__) || defined(__NetBSD)
|
||||
PRINT *, 'INFO:platform[NetBSD]'
|
||||
#elif defined(__OpenBSD__) || defined(__OPENBSD)
|
||||
PRINT *, 'INFO:platform[OpenBSD]'
|
||||
#elif defined(__sun) || defined(sun)
|
||||
PRINT *, 'INFO:platform[SunOS]'
|
||||
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
|
||||
PRINT *, 'INFO:platform[AIX]'
|
||||
#elif defined(__hpux) || defined(__hpux__)
|
||||
PRINT *, 'INFO:platform[HP-UX]'
|
||||
#elif defined(__HAIKU__)
|
||||
PRINT *, 'INFO:platform[Haiku]'
|
||||
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
|
||||
PRINT *, 'INFO:platform[BeOS]'
|
||||
#elif defined(__QNX__) || defined(__QNXNTO__)
|
||||
PRINT *, 'INFO:platform[QNX]'
|
||||
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
|
||||
PRINT *, 'INFO:platform[Tru64]'
|
||||
#elif defined(__riscos) || defined(__riscos__)
|
||||
PRINT *, 'INFO:platform[RISCos]'
|
||||
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
|
||||
PRINT *, 'INFO:platform[SINIX]'
|
||||
#elif defined(__UNIX_SV__)
|
||||
PRINT *, 'INFO:platform[UNIX_SV]'
|
||||
#elif defined(__bsdos__)
|
||||
PRINT *, 'INFO:platform[BSDOS]'
|
||||
#elif defined(_MPRAS) || defined(MPRAS)
|
||||
PRINT *, 'INFO:platform[MP-RAS]'
|
||||
#elif defined(__osf) || defined(__osf__)
|
||||
PRINT *, 'INFO:platform[OSF1]'
|
||||
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
|
||||
PRINT *, 'INFO:platform[SCO_SV]'
|
||||
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
|
||||
PRINT *, 'INFO:platform[ULTRIX]'
|
||||
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
|
||||
PRINT *, 'INFO:platform[Xenix]'
|
||||
#else
|
||||
PRINT *, 'INFO:platform[]'
|
||||
#endif
|
||||
#if defined(_WIN32) && (defined(__INTEL_COMPILER) || defined(__ICC))
|
||||
# if defined(_M_IA64)
|
||||
PRINT *, 'INFO:arch[IA64]'
|
||||
# elif defined(_M_X64) || defined(_M_AMD64)
|
||||
PRINT *, 'INFO:arch[x64]'
|
||||
# elif defined(_M_IX86)
|
||||
PRINT *, 'INFO:arch[X86]'
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
! Encode compiler version digits
|
||||
#endif
|
||||
#define DEC_8(n) (((n) / 10000000) % 10)
|
||||
#define DEC_7(n) (((n) / 1000000) % 10)
|
||||
#define DEC_6(n) (((n) / 100000) % 10)
|
||||
#define DEC_5(n) (((n) / 10000) % 10)
|
||||
#define DEC_4(n) (((n) / 1000) % 10)
|
||||
#define DEC_3(n) (((n) / 100) % 10)
|
||||
#define DEC_2(n) (((n) / 10) % 10)
|
||||
#define DEC_1(n) (((n) ) % 10)
|
||||
#define HEX_8(n) ((n)>>28 & 0xF)
|
||||
#define HEX_7(n) ((n)>>24 & 0xF)
|
||||
#define HEX_6(n) ((n)>>20 & 0xF)
|
||||
#define HEX_5(n) ((n)>>16 & 0xF)
|
||||
#define HEX_4(n) ((n)>>12 & 0xF)
|
||||
#define HEX_3(n) ((n)>>8 & 0xF)
|
||||
#define HEX_2(n) ((n)>>4 & 0xF)
|
||||
#define HEX_1(n) ((n) & 0xF)
|
||||
@CMAKE_Fortran_COMPILER_ID_VERSION_INFO@
|
||||
|
||||
END
|
|
@ -0,0 +1,222 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
include(CMakeLanguageInformation)
|
||||
|
||||
# This file sets the basic flags for the Fortran language in CMake.
|
||||
# It also loads the available platform file for the system-compiler
|
||||
# if it exists.
|
||||
|
||||
set(_INCLUDED_FILE 0)
|
||||
|
||||
# Load compiler-specific information.
|
||||
if(CMAKE_Fortran_COMPILER_ID)
|
||||
include(Compiler/${CMAKE_Fortran_COMPILER_ID}-Fortran OPTIONAL)
|
||||
endif()
|
||||
|
||||
set(CMAKE_BASE_NAME)
|
||||
get_filename_component(CMAKE_BASE_NAME "${CMAKE_Fortran_COMPILER}" NAME_WE)
|
||||
# since the gnu compiler has several names force g++
|
||||
if(CMAKE_COMPILER_IS_GNUG77)
|
||||
set(CMAKE_BASE_NAME g77)
|
||||
endif()
|
||||
if(CMAKE_Fortran_COMPILER_ID)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_Fortran_COMPILER_ID}-Fortran OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif()
|
||||
if (NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL
|
||||
RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif ()
|
||||
|
||||
# load any compiler-wrapper specific information
|
||||
if (CMAKE_Fortran_COMPILER_WRAPPER)
|
||||
__cmake_include_compiler_wrapper(Fortran)
|
||||
endif ()
|
||||
|
||||
# We specify the compiler information in the system file for some
|
||||
# platforms, but this language may not have been enabled when the file
|
||||
# was first included. Include it again to get the language info.
|
||||
# Remove this when all compiler info is removed from system files.
|
||||
if (NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
|
||||
endif ()
|
||||
|
||||
if(CMAKE_Fortran_SIZEOF_DATA_PTR)
|
||||
foreach(f ${CMAKE_Fortran_ABI_FILES})
|
||||
include(${f})
|
||||
endforeach()
|
||||
unset(CMAKE_Fortran_ABI_FILES)
|
||||
endif()
|
||||
|
||||
# This should be included before the _INIT variables are
|
||||
# used to initialize the cache. Since the rule variables
|
||||
# have if blocks on them, users can still define them here.
|
||||
# But, it should still be after the platform file so changes can
|
||||
# be made to those values.
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE)
|
||||
# Save the full path of the file so try_compile can use it.
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran)
|
||||
# Save the full path of the file so try_compile can use it.
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran "${_override}")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIC)
|
||||
set(CMAKE_Fortran_COMPILE_OPTIONS_PIC ${CMAKE_C_COMPILE_OPTIONS_PIC})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIE)
|
||||
set(CMAKE_Fortran_COMPILE_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE})
|
||||
endif()
|
||||
if(NOT CMAKE_Fortran_LINK_OPTIONS_PIE)
|
||||
set(CMAKE_Fortran_LINK_OPTIONS_PIE ${CMAKE_C_LINK_OPTIONS_PIE})
|
||||
endif()
|
||||
if(NOT CMAKE_Fortran_LINK_OPTIONS_NO_PIE)
|
||||
set(CMAKE_Fortran_LINK_OPTIONS_NO_PIE ${CMAKE_C_LINK_OPTIONS_NO_PIE})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_Fortran_COMPILE_OPTIONS_DLL)
|
||||
set(CMAKE_Fortran_COMPILE_OPTIONS_DLL ${CMAKE_C_COMPILE_OPTIONS_DLL})
|
||||
endif()
|
||||
|
||||
# Create a set of shared library variable specific to Fortran
|
||||
# For 90% of the systems, these are the same flags as the C versions
|
||||
# so if these are not set just copy the flags from the c version
|
||||
if(NOT DEFINED CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS)
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_SHARED_LIBRARY_Fortran_FLAGS)
|
||||
set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS)
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG)
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP)
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG)
|
||||
set(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_EXE_EXPORTS_Fortran_FLAG)
|
||||
set(CMAKE_EXE_EXPORTS_Fortran_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG)
|
||||
set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG})
|
||||
endif()
|
||||
|
||||
# for most systems a module is the same as a shared library
|
||||
# so unless the variable CMAKE_MODULE_EXISTS is set just
|
||||
# copy the values from the LIBRARY variables
|
||||
if(NOT CMAKE_MODULE_EXISTS)
|
||||
set(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_Fortran_FLAGS})
|
||||
set(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS})
|
||||
endif()
|
||||
|
||||
# repeat for modules
|
||||
if(NOT DEFINED CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS)
|
||||
set(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_SHARED_MODULE_Fortran_FLAGS)
|
||||
set(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH)
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_INCLUDE_FLAG_Fortran)
|
||||
set(CMAKE_INCLUDE_FLAG_Fortran ${CMAKE_INCLUDE_FLAG_C})
|
||||
endif()
|
||||
|
||||
set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.")
|
||||
|
||||
set(CMAKE_Fortran_FLAGS_INIT "$ENV{FFLAGS} ${CMAKE_Fortran_FLAGS_INIT}")
|
||||
|
||||
cmake_initialize_per_config_variable(CMAKE_Fortran_FLAGS "Flags used by the Fortran compiler")
|
||||
|
||||
if(NOT CMAKE_Fortran_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_Fortran_COMPILER_LAUNCHER})
|
||||
set(CMAKE_Fortran_COMPILER_LAUNCHER "$ENV{CMAKE_Fortran_COMPILER_LAUNCHER}"
|
||||
CACHE STRING "Compiler launcher for Fortran.")
|
||||
endif()
|
||||
|
||||
include(CMakeCommonLanguageInclude)
|
||||
|
||||
# now define the following rule variables
|
||||
# CMAKE_Fortran_CREATE_SHARED_LIBRARY
|
||||
# CMAKE_Fortran_CREATE_SHARED_MODULE
|
||||
# CMAKE_Fortran_COMPILE_OBJECT
|
||||
# CMAKE_Fortran_LINK_EXECUTABLE
|
||||
|
||||
# create a Fortran shared library
|
||||
if(NOT CMAKE_Fortran_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_Fortran_CREATE_SHARED_LIBRARY
|
||||
"<CMAKE_Fortran_COMPILER> <CMAKE_SHARED_LIBRARY_Fortran_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
# create a Fortran shared module just copy the shared library rule
|
||||
if(NOT CMAKE_Fortran_CREATE_SHARED_MODULE)
|
||||
set(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY})
|
||||
endif()
|
||||
|
||||
# Create a static archive incrementally for large object file counts.
|
||||
# If CMAKE_Fortran_CREATE_STATIC_LIBRARY is set it will override these.
|
||||
if(NOT DEFINED CMAKE_Fortran_ARCHIVE_CREATE)
|
||||
set(CMAKE_Fortran_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_Fortran_ARCHIVE_APPEND)
|
||||
set(CMAKE_Fortran_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_Fortran_ARCHIVE_FINISH)
|
||||
set(CMAKE_Fortran_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
|
||||
endif()
|
||||
|
||||
# compile a Fortran file into an object file
|
||||
# (put -o after -c to workaround bug in at least one mpif77 wrapper)
|
||||
if(NOT CMAKE_Fortran_COMPILE_OBJECT)
|
||||
set(CMAKE_Fortran_COMPILE_OBJECT
|
||||
"<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -c <SOURCE> -o <OBJECT>")
|
||||
endif()
|
||||
|
||||
# link a fortran program
|
||||
if(NOT CMAKE_Fortran_LINK_EXECUTABLE)
|
||||
set(CMAKE_Fortran_LINK_EXECUTABLE
|
||||
"<CMAKE_Fortran_COMPILER> <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
if(CMAKE_Fortran_STANDARD_LIBRARIES_INIT)
|
||||
set(CMAKE_Fortran_STANDARD_LIBRARIES "${CMAKE_Fortran_STANDARD_LIBRARIES_INIT}"
|
||||
CACHE STRING "Libraries linked by default with all Fortran applications.")
|
||||
mark_as_advanced(CMAKE_Fortran_STANDARD_LIBRARIES)
|
||||
endif()
|
||||
|
||||
# set this variable so we can avoid loading this more than once.
|
||||
set(CMAKE_Fortran_INFORMATION_LOADED 1)
|
|
@ -0,0 +1,183 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
include(CMakeInitializeConfigs)
|
||||
|
||||
set(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
|
||||
set(CMAKE_INCLUDE_FLAG_C "-I") # -I
|
||||
set(CMAKE_LIBRARY_PATH_FLAG "-L")
|
||||
set(CMAKE_LIBRARY_PATH_TERMINATOR "") # for the Digital Mars D compiler the link paths have to be terminated with a "/"
|
||||
set(CMAKE_LINK_LIBRARY_FLAG "-l")
|
||||
|
||||
set(CMAKE_LINK_LIBRARY_SUFFIX "")
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
||||
set(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") # .so
|
||||
set(CMAKE_EXECUTABLE_SUFFIX "") # .exe
|
||||
set(CMAKE_DL_LIBS "dl")
|
||||
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
|
||||
|
||||
set(CMAKE_AUTOGEN_ORIGIN_DEPENDS ON)
|
||||
set(CMAKE_AUTOMOC_COMPILER_PREDEFINES ON)
|
||||
if(NOT DEFINED CMAKE_AUTOMOC_PATH_PREFIX)
|
||||
set(CMAKE_AUTOMOC_PATH_PREFIX OFF)
|
||||
endif()
|
||||
set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_NAMESPACE" "Q_NAMESPACE_EXPORT")
|
||||
|
||||
# basically all general purpose OSs support shared libs
|
||||
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
|
||||
|
||||
set (CMAKE_SKIP_RPATH "NO" CACHE BOOL
|
||||
"If set, runtime paths are not added when using shared libraries.")
|
||||
set (CMAKE_SKIP_INSTALL_RPATH "NO" CACHE BOOL
|
||||
"If set, runtime paths are not added when installing shared libraries, but are added when building.")
|
||||
|
||||
set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.")
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Make")
|
||||
set(CMAKE_COLOR_MAKEFILE ON CACHE BOOL
|
||||
"Enable/Disable color output during build."
|
||||
)
|
||||
mark_as_advanced(CMAKE_COLOR_MAKEFILE)
|
||||
if(DEFINED CMAKE_RULE_MESSAGES)
|
||||
set_property(GLOBAL PROPERTY RULE_MESSAGES ${CMAKE_RULE_MESSAGES})
|
||||
endif()
|
||||
if(DEFINED CMAKE_TARGET_MESSAGES)
|
||||
set_property(GLOBAL PROPERTY TARGET_MESSAGES ${CMAKE_TARGET_MESSAGES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS AND CMAKE_GENERATOR MATCHES "Ninja|Unix Makefiles")
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS "$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}"
|
||||
CACHE BOOL "Enable/Disable output of compile commands during generation."
|
||||
)
|
||||
mark_as_advanced(CMAKE_EXPORT_COMPILE_COMMANDS)
|
||||
endif()
|
||||
|
||||
# GetDefaultWindowsPrefixBase
|
||||
#
|
||||
# Compute the base directory for CMAKE_INSTALL_PREFIX based on:
|
||||
# - is this 32-bit or 64-bit Windows
|
||||
# - is this 32-bit or 64-bit CMake running
|
||||
# - what architecture targets will be built
|
||||
#
|
||||
function(GetDefaultWindowsPrefixBase var)
|
||||
|
||||
# Try to guess what architecture targets will end up being built as,
|
||||
# even if CMAKE_SIZEOF_VOID_P is not computed yet... We need to know
|
||||
# the architecture of the targets being built to choose the right
|
||||
# default value for CMAKE_INSTALL_PREFIX.
|
||||
#
|
||||
if("${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)")
|
||||
set(arch_hint "x64")
|
||||
elseif("${CMAKE_GENERATOR_PLATFORM}" MATCHES "ARM64")
|
||||
set(arch_hint "ARM64")
|
||||
elseif("${CMAKE_GENERATOR}" MATCHES "ARM")
|
||||
set(arch_hint "ARM")
|
||||
elseif("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
||||
set(arch_hint "x64")
|
||||
elseif("$ENV{LIB}" MATCHES "(amd64|ia64)")
|
||||
set(arch_hint "x64")
|
||||
endif()
|
||||
|
||||
if(NOT arch_hint)
|
||||
set(arch_hint "x86")
|
||||
endif()
|
||||
|
||||
# default env in a 64-bit app on Win64:
|
||||
# ProgramFiles=C:\Program Files
|
||||
# ProgramFiles(x86)=C:\Program Files (x86)
|
||||
# ProgramW6432=C:\Program Files
|
||||
#
|
||||
# default env in a 32-bit app on Win64:
|
||||
# ProgramFiles=C:\Program Files (x86)
|
||||
# ProgramFiles(x86)=C:\Program Files (x86)
|
||||
# ProgramW6432=C:\Program Files
|
||||
#
|
||||
# default env in a 32-bit app on Win32:
|
||||
# ProgramFiles=C:\Program Files
|
||||
# ProgramFiles(x86) NOT DEFINED
|
||||
# ProgramW6432 NOT DEFINED
|
||||
|
||||
# By default, use the ProgramFiles env var as the base value of
|
||||
# CMAKE_INSTALL_PREFIX:
|
||||
#
|
||||
set(_PREFIX_ENV_VAR "ProgramFiles")
|
||||
|
||||
if ("$ENV{ProgramW6432}" STREQUAL "")
|
||||
# running on 32-bit Windows
|
||||
# must be a 32-bit CMake, too...
|
||||
#message("guess: this is a 32-bit CMake running on 32-bit Windows")
|
||||
else()
|
||||
# running on 64-bit Windows
|
||||
if ("$ENV{ProgramW6432}" STREQUAL "$ENV{ProgramFiles}")
|
||||
# 64-bit CMake
|
||||
#message("guess: this is a 64-bit CMake running on 64-bit Windows")
|
||||
if(NOT "${arch_hint}" STREQUAL "x64")
|
||||
# building 32-bit targets
|
||||
set(_PREFIX_ENV_VAR "ProgramFiles(x86)")
|
||||
endif()
|
||||
else()
|
||||
# 32-bit CMake
|
||||
#message("guess: this is a 32-bit CMake running on 64-bit Windows")
|
||||
if("${arch_hint}" STREQUAL "x64")
|
||||
# building 64-bit targets
|
||||
set(_PREFIX_ENV_VAR "ProgramW6432")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#if("${arch_hint}" STREQUAL "x64")
|
||||
# message("guess: you are building a 64-bit app")
|
||||
#else()
|
||||
# message("guess: you are building a 32-bit app")
|
||||
#endif()
|
||||
|
||||
if(NOT "$ENV{${_PREFIX_ENV_VAR}}" STREQUAL "")
|
||||
file(TO_CMAKE_PATH "$ENV{${_PREFIX_ENV_VAR}}" _base)
|
||||
elseif(NOT "$ENV{SystemDrive}" STREQUAL "")
|
||||
set(_base "$ENV{SystemDrive}/Program Files")
|
||||
else()
|
||||
set(_base "C:/Program Files")
|
||||
endif()
|
||||
|
||||
set(${var} "${_base}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Set a variable to indicate whether the value of CMAKE_INSTALL_PREFIX
|
||||
# was initialized by the block below. This is useful for user
|
||||
# projects to change the default prefix while still allowing the
|
||||
# command line to override it.
|
||||
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
|
||||
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 1)
|
||||
endif()
|
||||
|
||||
# Choose a default install prefix for this platform.
|
||||
if(CMAKE_HOST_UNIX)
|
||||
set(CMAKE_INSTALL_PREFIX "/usr/local"
|
||||
CACHE PATH "Install path prefix, prepended onto install directories.")
|
||||
else()
|
||||
GetDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES)
|
||||
set(CMAKE_INSTALL_PREFIX
|
||||
"${CMAKE_GENERIC_PROGRAM_FILES}/${PROJECT_NAME}"
|
||||
CACHE PATH "Install path prefix, prepended onto install directories.")
|
||||
set(CMAKE_GENERIC_PROGRAM_FILES)
|
||||
endif()
|
||||
|
||||
# Set a variable which will be used as component name in install() commands
|
||||
# where no COMPONENT has been given:
|
||||
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "Unspecified")
|
||||
|
||||
mark_as_advanced(
|
||||
CMAKE_SKIP_RPATH
|
||||
CMAKE_SKIP_INSTALL_RPATH
|
||||
CMAKE_VERBOSE_MAKEFILE
|
||||
)
|
|
@ -0,0 +1,149 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
CMakeGraphVizOptions
|
||||
--------------------
|
||||
|
||||
The builtin Graphviz support of CMake.
|
||||
|
||||
Generating Graphviz files
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
CMake can generate `Graphviz <https://www.graphviz.org/>`_ files showing the
|
||||
dependencies between the targets in a project, as well as external libraries
|
||||
which are linked against.
|
||||
|
||||
When running CMake with the ``--graphviz=foo.dot`` option, it produces:
|
||||
|
||||
* a ``foo.dot`` file, showing all dependencies in the project
|
||||
* a ``foo.dot.<target>`` file for each target, showing on which other targets
|
||||
it depends
|
||||
* a ``foo.dot.<target>.dependers`` file for each target, showing which other
|
||||
targets depend on it
|
||||
|
||||
Those .dot files can be converted to images using the *dot* command from the
|
||||
Graphviz package:
|
||||
|
||||
.. code-block:: shell
|
||||
|
||||
dot -Tpng -o foo.png foo.dot
|
||||
|
||||
The different dependency types ``PUBLIC``, ``INTERFACE`` and ``PRIVATE``
|
||||
are represented as solid, dashed and dotted edges.
|
||||
|
||||
Variables specific to the Graphviz support
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The resulting graphs can be huge. The look and content of the generated graphs
|
||||
can be controlled using the file ``CMakeGraphVizOptions.cmake``. This file is
|
||||
first searched in :variable:`CMAKE_BINARY_DIR`, and then in
|
||||
:variable:`CMAKE_SOURCE_DIR`. If found, the variables set in it are used to
|
||||
adjust options for the generated Graphviz files.
|
||||
|
||||
.. variable:: GRAPHVIZ_GRAPH_NAME
|
||||
|
||||
The graph name.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: value of :variable:`CMAKE_PROJECT_NAME`
|
||||
|
||||
.. variable:: GRAPHVIZ_GRAPH_HEADER
|
||||
|
||||
The header written at the top of the Graphviz files.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: "node [ fontsize = "12" ];"
|
||||
|
||||
.. variable:: GRAPHVIZ_NODE_PREFIX
|
||||
|
||||
The prefix for each node in the Graphviz files.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: "node"
|
||||
|
||||
.. variable:: GRAPHVIZ_EXECUTABLES
|
||||
|
||||
Set to FALSE to exclude executables from the generated graphs.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: TRUE
|
||||
|
||||
.. variable:: GRAPHVIZ_STATIC_LIBS
|
||||
|
||||
Set to FALSE to exclude static libraries from the generated graphs.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: TRUE
|
||||
|
||||
.. variable:: GRAPHVIZ_SHARED_LIBS
|
||||
|
||||
Set to FALSE to exclude shared libraries from the generated graphs.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: TRUE
|
||||
|
||||
.. variable:: GRAPHVIZ_MODULE_LIBS
|
||||
|
||||
Set to FALSE to exclude module libraries from the generated graphs.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: TRUE
|
||||
|
||||
.. variable:: GRAPHVIZ_INTERFACE_LIBS
|
||||
|
||||
Set to FALSE to exclude interface libraries from the generated graphs.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: TRUE
|
||||
|
||||
.. variable:: GRAPHVIZ_OBJECT_LIBS
|
||||
|
||||
Set to FALSE to exclude object libraries from the generated graphs.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: TRUE
|
||||
|
||||
.. variable:: GRAPHVIZ_UNKNOWN_LIBS
|
||||
|
||||
Set to FALSE to exclude unknown libraries from the generated graphs.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: TRUE
|
||||
|
||||
.. variable:: GRAPHVIZ_EXTERNAL_LIBS
|
||||
|
||||
Set to FALSE to exclude external libraries from the generated graphs.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: TRUE
|
||||
|
||||
.. variable:: GRAPHVIZ_CUSTOM_TARGETS
|
||||
|
||||
Set to TRUE to include custom targets in the generated graphs.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: FALSE
|
||||
|
||||
.. variable:: GRAPHVIZ_IGNORE_TARGETS
|
||||
|
||||
A list of regular expressions for names of targets to exclude from the
|
||||
generated graphs.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: empty
|
||||
|
||||
.. variable:: GRAPHVIZ_GENERATE_PER_TARGET
|
||||
|
||||
Set to FALSE to not generate per-target graphs ``foo.dot.<target>``.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: TRUE
|
||||
|
||||
.. variable:: GRAPHVIZ_GENERATE_DEPENDERS
|
||||
|
||||
Set to FALSE to not generate depender graphs ``foo.dot.<target>.dependers``.
|
||||
|
||||
* Mandatory: NO
|
||||
* Default: TRUE
|
||||
#]=======================================================================]
|
|
@ -0,0 +1,312 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0057 NEW) # if IN_LIST
|
||||
|
||||
# Function to print messages of this module
|
||||
function(_ios_install_combined_message)
|
||||
message("[iOS combined] " ${ARGN})
|
||||
endfunction()
|
||||
|
||||
# Get build settings for the current target/config/SDK by running
|
||||
# `xcodebuild -sdk ... -showBuildSettings` and parsing it's output
|
||||
function(_ios_install_combined_get_build_setting sdk variable resultvar)
|
||||
if("${sdk}" STREQUAL "")
|
||||
message(FATAL_ERROR "`sdk` is empty")
|
||||
endif()
|
||||
|
||||
if("${variable}" STREQUAL "")
|
||||
message(FATAL_ERROR "`variable` is empty")
|
||||
endif()
|
||||
|
||||
if("${resultvar}" STREQUAL "")
|
||||
message(FATAL_ERROR "`resultvar` is empty")
|
||||
endif()
|
||||
|
||||
set(
|
||||
cmd
|
||||
xcodebuild -showBuildSettings
|
||||
-sdk "${sdk}"
|
||||
-target "${CURRENT_TARGET}"
|
||||
-config "${CURRENT_CONFIG}"
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${cmd}
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
)
|
||||
|
||||
if(NOT result EQUAL 0)
|
||||
message(FATAL_ERROR "Command failed (${result}): ${cmd}")
|
||||
endif()
|
||||
|
||||
if(NOT output MATCHES " ${variable} = ([^\n]*)")
|
||||
if("${variable}" STREQUAL "VALID_ARCHS")
|
||||
# VALID_ARCHS may be unset by user for given SDK
|
||||
# (e.g. for build without simulator).
|
||||
set("${resultvar}" "" PARENT_SCOPE)
|
||||
return()
|
||||
else()
|
||||
message(FATAL_ERROR "${variable} not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set("${resultvar}" "${CMAKE_MATCH_1}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Get architectures of given SDK (iphonesimulator/iphoneos)
|
||||
function(_ios_install_combined_get_valid_archs sdk resultvar)
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0007 NEW)
|
||||
|
||||
if("${resultvar}" STREQUAL "")
|
||||
message(FATAL_ERROR "`resultvar` is empty")
|
||||
endif()
|
||||
|
||||
_ios_install_combined_get_build_setting("${sdk}" "VALID_ARCHS" valid_archs)
|
||||
|
||||
separate_arguments(valid_archs)
|
||||
list(REMOVE_ITEM valid_archs "") # remove empty elements
|
||||
list(REMOVE_DUPLICATES valid_archs)
|
||||
|
||||
string(REPLACE ";" " " printable "${valid_archs}")
|
||||
_ios_install_combined_message("Architectures (${sdk}): ${printable}")
|
||||
|
||||
set("${resultvar}" "${valid_archs}" PARENT_SCOPE)
|
||||
|
||||
cmake_policy(POP)
|
||||
endfunction()
|
||||
|
||||
# Final target can contain more architectures that specified by SDK. This
|
||||
# function will run 'lipo -info' and parse output. Result will be returned
|
||||
# as a CMake list.
|
||||
function(_ios_install_combined_get_real_archs filename resultvar)
|
||||
set(cmd "${_lipo_path}" -info "${filename}")
|
||||
execute_process(
|
||||
COMMAND ${cmd}
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_VARIABLE output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT result EQUAL 0)
|
||||
message(
|
||||
FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT output MATCHES "(Architectures in the fat file: [^\n]+ are|Non-fat file: [^\n]+ is architecture): ([^\n]*)")
|
||||
message(FATAL_ERROR "Could not detect architecture from: ${output}")
|
||||
endif()
|
||||
|
||||
separate_arguments(CMAKE_MATCH_2)
|
||||
set(${resultvar} ${CMAKE_MATCH_2} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Run build command for the given SDK
|
||||
function(_ios_install_combined_build sdk)
|
||||
if("${sdk}" STREQUAL "")
|
||||
message(FATAL_ERROR "`sdk` is empty")
|
||||
endif()
|
||||
|
||||
_ios_install_combined_message("Build `${CURRENT_TARGET}` for `${sdk}`")
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}"
|
||||
--build
|
||||
.
|
||||
--target "${CURRENT_TARGET}"
|
||||
--config ${CURRENT_CONFIG}
|
||||
--
|
||||
-sdk "${sdk}"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
RESULT_VARIABLE result
|
||||
)
|
||||
|
||||
if(NOT result EQUAL 0)
|
||||
message(FATAL_ERROR "Build failed")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Remove given architecture from file. This step needed only in rare cases
|
||||
# when target was built in "unusual" way. Emit warning message.
|
||||
function(_ios_install_combined_remove_arch lib arch)
|
||||
_ios_install_combined_message(
|
||||
"Warning! Unexpected architecture `${arch}` detected and will be removed "
|
||||
"from file `${lib}`")
|
||||
set(cmd "${_lipo_path}" -remove ${arch} -output ${lib} ${lib})
|
||||
execute_process(
|
||||
COMMAND ${cmd}
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_VARIABLE output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT result EQUAL 0)
|
||||
message(
|
||||
FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}"
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Check that 'lib' contains only 'archs' architectures (remove others).
|
||||
function(_ios_install_combined_keep_archs lib archs)
|
||||
_ios_install_combined_get_real_archs("${lib}" real_archs)
|
||||
set(archs_to_remove ${real_archs})
|
||||
list(REMOVE_ITEM archs_to_remove ${archs})
|
||||
foreach(x ${archs_to_remove})
|
||||
_ios_install_combined_remove_arch("${lib}" "${x}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(_ios_install_combined_detect_sdks this_sdk_var corr_sdk_var)
|
||||
set(this_sdk "$ENV{PLATFORM_NAME}")
|
||||
if("${this_sdk}" STREQUAL "")
|
||||
message(FATAL_ERROR "Environment variable PLATFORM_NAME is empty")
|
||||
endif()
|
||||
|
||||
set(all_platforms "$ENV{SUPPORTED_PLATFORMS}")
|
||||
if("${all_platforms}" STREQUAL "")
|
||||
message(FATAL_ERROR "Environment variable SUPPORTED_PLATFORMS is empty")
|
||||
endif()
|
||||
|
||||
separate_arguments(all_platforms)
|
||||
if(NOT this_sdk IN_LIST all_platforms)
|
||||
message(FATAL_ERROR "`${this_sdk}` not found in `${all_platforms}`")
|
||||
endif()
|
||||
|
||||
list(REMOVE_ITEM all_platforms "" "${this_sdk}")
|
||||
list(LENGTH all_platforms all_platforms_length)
|
||||
if(NOT all_platforms_length EQUAL 1)
|
||||
message(FATAL_ERROR "Expected one element: ${all_platforms}")
|
||||
endif()
|
||||
|
||||
set(${this_sdk_var} "${this_sdk}" PARENT_SCOPE)
|
||||
set(${corr_sdk_var} "${all_platforms}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Create combined binary for the given target.
|
||||
#
|
||||
# Preconditions:
|
||||
# * Target already installed at ${destination}
|
||||
# for the ${PLATFORM_NAME} platform
|
||||
#
|
||||
# This function will:
|
||||
# * Run build for the lacking platform, i.e. opposite to the ${PLATFORM_NAME}
|
||||
# * Fuse both libraries by running lipo
|
||||
function(ios_install_combined target destination)
|
||||
if("${target}" STREQUAL "")
|
||||
message(FATAL_ERROR "`target` is empty")
|
||||
endif()
|
||||
|
||||
if("${destination}" STREQUAL "")
|
||||
message(FATAL_ERROR "`destination` is empty")
|
||||
endif()
|
||||
|
||||
if(NOT IS_ABSOLUTE "${destination}")
|
||||
message(FATAL_ERROR "`destination` is not absolute: ${destination}")
|
||||
endif()
|
||||
|
||||
if(IS_DIRECTORY "${destination}" OR IS_SYMLINK "${destination}")
|
||||
message(FATAL_ERROR "`destination` is no regular file: ${destination}")
|
||||
endif()
|
||||
|
||||
if("${CMAKE_BINARY_DIR}" STREQUAL "")
|
||||
message(FATAL_ERROR "`CMAKE_BINARY_DIR` is empty")
|
||||
endif()
|
||||
|
||||
if(NOT IS_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
message(FATAL_ERROR "Is not a directory: ${CMAKE_BINARY_DIR}")
|
||||
endif()
|
||||
|
||||
if("${CMAKE_INSTALL_CONFIG_NAME}" STREQUAL "")
|
||||
message(FATAL_ERROR "CMAKE_INSTALL_CONFIG_NAME is empty")
|
||||
endif()
|
||||
|
||||
set(cmd xcrun -f lipo)
|
||||
|
||||
# Do not merge OUTPUT_VARIABLE and ERROR_VARIABLE since latter may contain
|
||||
# some diagnostic information even for the successful run.
|
||||
execute_process(
|
||||
COMMAND ${cmd}
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_VARIABLE error_output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT result EQUAL 0)
|
||||
message(
|
||||
FATAL_ERROR "Command failed (${result}): ${cmd}\n\nOutput:\n${output}\nOutput(error):\n${error_output}"
|
||||
)
|
||||
endif()
|
||||
set(_lipo_path ${output})
|
||||
list(LENGTH _lipo_path len)
|
||||
if(NOT len EQUAL 1)
|
||||
message(FATAL_ERROR "Unexpected xcrun output: ${_lipo_path}")
|
||||
endif()
|
||||
if(NOT EXISTS "${_lipo_path}")
|
||||
message(FATAL_ERROR "File not found: ${_lipo_path}")
|
||||
endif()
|
||||
|
||||
set(CURRENT_CONFIG "${CMAKE_INSTALL_CONFIG_NAME}")
|
||||
set(CURRENT_TARGET "${target}")
|
||||
|
||||
_ios_install_combined_message("Target: ${CURRENT_TARGET}")
|
||||
_ios_install_combined_message("Config: ${CURRENT_CONFIG}")
|
||||
_ios_install_combined_message("Destination: ${destination}")
|
||||
|
||||
# Get SDKs
|
||||
_ios_install_combined_detect_sdks(this_sdk corr_sdk)
|
||||
|
||||
# Get architectures of the target
|
||||
_ios_install_combined_get_valid_archs("${corr_sdk}" corr_valid_archs)
|
||||
_ios_install_combined_get_valid_archs("${this_sdk}" this_valid_archs)
|
||||
|
||||
# Return if there are no valid architectures for the SDK.
|
||||
# (note that library already installed)
|
||||
if("${corr_valid_archs}" STREQUAL "")
|
||||
_ios_install_combined_message(
|
||||
"No architectures detected for `${corr_sdk}` (skip)"
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Trigger build of corresponding target
|
||||
_ios_install_combined_build("${corr_sdk}")
|
||||
|
||||
# Get location of the library in build directory
|
||||
_ios_install_combined_get_build_setting(
|
||||
"${corr_sdk}" "CONFIGURATION_BUILD_DIR" corr_build_dir)
|
||||
_ios_install_combined_get_build_setting(
|
||||
"${corr_sdk}" "EXECUTABLE_PATH" corr_executable_path)
|
||||
set(corr "${corr_build_dir}/${corr_executable_path}")
|
||||
|
||||
_ios_install_combined_keep_archs("${corr}" "${corr_valid_archs}")
|
||||
_ios_install_combined_keep_archs("${destination}" "${this_valid_archs}")
|
||||
|
||||
_ios_install_combined_message("Current: ${destination}")
|
||||
_ios_install_combined_message("Corresponding: ${corr}")
|
||||
|
||||
set(cmd "${_lipo_path}" -create ${corr} ${destination} -output ${destination})
|
||||
|
||||
execute_process(
|
||||
COMMAND ${cmd}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
RESULT_VARIABLE result
|
||||
)
|
||||
|
||||
if(NOT result EQUAL 0)
|
||||
message(FATAL_ERROR "Command failed: ${cmd}")
|
||||
endif()
|
||||
|
||||
_ios_install_combined_message("Install done: ${destination}")
|
||||
endfunction()
|
||||
|
||||
cmake_policy(POP)
|
|
@ -0,0 +1,13 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This module is purposely no longer documented. It does nothing useful.
|
||||
|
||||
# This macro used to load build settings from another project that
|
||||
# stored settings using the CMAKE_EXPORT_BUILD_SETTINGS macro.
|
||||
macro(CMAKE_IMPORT_BUILD_SETTINGS SETTINGS_FILE)
|
||||
if("${SETTINGS_FILE}" STREQUAL "")
|
||||
message(SEND_ERROR "CMAKE_IMPORT_BUILD_SETTINGS called with no argument.")
|
||||
endif()
|
||||
endmacro()
|
|
@ -0,0 +1,39 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# Initializes `<_PREFIX>_<CONFIG>` variables from the corresponding
|
||||
# `<_PREFIX>_<CONFIG>_INIT`, for the configurations currently used.
|
||||
function(cmake_initialize_per_config_variable _PREFIX _DOCSTRING)
|
||||
string(STRIP "${${_PREFIX}_INIT}" _INIT)
|
||||
set("${_PREFIX}" "${_INIT}"
|
||||
CACHE STRING "${_DOCSTRING} during all build types.")
|
||||
mark_as_advanced("${_PREFIX}")
|
||||
|
||||
if (NOT CMAKE_NOT_USING_CONFIG_FLAGS)
|
||||
set(_CONFIGS Debug Release MinSizeRel RelWithDebInfo)
|
||||
|
||||
get_property(_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if (_GENERATOR_IS_MULTI_CONFIG)
|
||||
list(APPEND _CONFIGS ${CMAKE_CONFIGURATION_TYPES})
|
||||
else()
|
||||
if (NOT CMAKE_NO_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE_INIT}" CACHE STRING
|
||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...")
|
||||
endif()
|
||||
list(APPEND _CONFIGS ${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES _CONFIGS)
|
||||
foreach(_BUILD_TYPE IN LISTS _CONFIGS)
|
||||
if (NOT "${_BUILD_TYPE}" STREQUAL "")
|
||||
string(TOUPPER "${_BUILD_TYPE}" _BUILD_TYPE)
|
||||
string(STRIP "${${_PREFIX}_${_BUILD_TYPE}_INIT}" _INIT)
|
||||
set("${_PREFIX}_${_BUILD_TYPE}" "${_INIT}"
|
||||
CACHE STRING "${_DOCSTRING} during ${_BUILD_TYPE} builds.")
|
||||
mark_as_advanced("${_PREFIX}_${_BUILD_TYPE}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
|
@ -0,0 +1,7 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
set (CMAKE_MAKE_PROGRAM "jom" CACHE STRING
|
||||
"Program used to build from makefiles.")
|
||||
mark_as_advanced(CMAKE_MAKE_PROGRAM)
|
|
@ -0,0 +1,13 @@
|
|||
set(CMAKE_Java_COMPILER "@CMAKE_Java_COMPILER@")
|
||||
set(CMAKE_Java_COMPILER_ARG1 "@CMAKE_Java_COMPILER_ARG1@")
|
||||
set(CMAKE_Java_RUNTIME "@CMAKE_Java_RUNTIME@")
|
||||
set(CMAKE_Java_ARCHIVE "@CMAKE_Java_ARCHIVE@")
|
||||
set(CMAKE_Java_COMPILER_LOADED 1)
|
||||
|
||||
set(CMAKE_Java_SOURCE_FILE_EXTENSIONS java)
|
||||
set(CMAKE_Java_LINKER_PREFERENCE 40)
|
||||
set(CMAKE_Java_OUTPUT_EXTENSION .class)
|
||||
set(CMAKE_Java_OUTPUT_EXTENSION_REPLACE 1)
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX_Java "")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX_Java ".jar")
|
||||
set(CMAKE_Java_COMPILER_ENV_VAR "JAVA_COMPILER")
|
|
@ -0,0 +1,49 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This should be included before the _INIT variables are
|
||||
# used to initialize the cache. Since the rule variables
|
||||
# have if blocks on them, users can still define them here.
|
||||
# But, it should still be after the platform file so changes can
|
||||
# be made to those values.
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE)
|
||||
# Save the full path of the file so try_compile can use it.
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE_Java)
|
||||
# Save the full path of the file so try_compile can use it.
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE_Java} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE_Java "${_override}")
|
||||
endif()
|
||||
|
||||
# this is a place holder if java needed flags for javac they would go here.
|
||||
if(NOT CMAKE_Java_CREATE_STATIC_LIBRARY)
|
||||
# if(WIN32)
|
||||
# set(class_files_mask "*.class")
|
||||
# else()
|
||||
set(class_files_mask ".")
|
||||
# endif()
|
||||
|
||||
set(CMAKE_Java_CREATE_STATIC_LIBRARY
|
||||
"<CMAKE_Java_ARCHIVE> -cf <TARGET> -C <OBJECT_DIR> ${class_files_mask}")
|
||||
# "${class_files_mask}" should really be "<OBJECTS>" but compiling a *.java
|
||||
# file can create more than one *.class file...
|
||||
endif()
|
||||
|
||||
# compile a Java file into an object file
|
||||
if(NOT CMAKE_Java_COMPILE_OBJECT)
|
||||
set(CMAKE_Java_COMPILE_OBJECT
|
||||
"<CMAKE_Java_COMPILER> <FLAGS> <SOURCE> -d <OBJECT_DIR>")
|
||||
endif()
|
||||
|
||||
# set java include flag option and the separator for multiple include paths
|
||||
set(CMAKE_INCLUDE_FLAG_Java "-classpath ")
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
set(CMAKE_INCLUDE_FLAG_SEP_Java ";")
|
||||
else()
|
||||
set(CMAKE_INCLUDE_FLAG_SEP_Java ":")
|
||||
endif()
|
|
@ -0,0 +1,27 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This file contains common code blocks used by all the language information
|
||||
# files
|
||||
|
||||
# load any compiler-wrapper specific information
|
||||
macro(__cmake_include_compiler_wrapper lang)
|
||||
set(_INCLUDED_WRAPPER_FILE 0)
|
||||
if (CMAKE_${lang}_COMPILER_ID)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_${lang}_COMPILER_WRAPPER}-${CMAKE_${lang}_COMPILER_ID}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE)
|
||||
endif()
|
||||
if (NOT _INCLUDED_WRAPPER_FILE)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_${lang}_COMPILER_WRAPPER}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE)
|
||||
endif ()
|
||||
|
||||
# No platform - wrapper - lang information so maybe there's just wrapper - lang information
|
||||
if(NOT _INCLUDED_WRAPPER_FILE)
|
||||
if (CMAKE_${lang}_COMPILER_ID)
|
||||
include(Compiler/${CMAKE_${lang}_COMPILER_WRAPPER}-${CMAKE_${lang}_COMPILER_ID}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE)
|
||||
endif()
|
||||
if (NOT _INCLUDED_WRAPPER_FILE)
|
||||
include(Compiler/${CMAKE_${lang}_COMPILER_WRAPPER}-${lang} OPTIONAL RESULT_VARIABLE _INCLUDED_WRAPPER_FILE)
|
||||
endif ()
|
||||
endif ()
|
||||
endmacro ()
|
|
@ -0,0 +1,10 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
find_program(CMAKE_MAKE_PROGRAM make
|
||||
PATHS
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MSYS-1.0_is1;Inno Setup: App Path]/bin"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin"
|
||||
c:/msys/1.0/bin /msys/1.0/bin)
|
||||
mark_as_advanced(CMAKE_MAKE_PROGRAM)
|
|
@ -0,0 +1,11 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
find_program(CMAKE_MAKE_PROGRAM mingw32-make.exe PATHS
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW;InstallLocation]/bin"
|
||||
c:/MinGW/bin /MinGW/bin
|
||||
"[HKEY_CURRENT_USER\\Software\\CodeBlocks;Path]/MinGW/bin"
|
||||
)
|
||||
|
||||
mark_as_advanced(CMAKE_MAKE_PROGRAM)
|
|
@ -0,0 +1,7 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
set (CMAKE_MAKE_PROGRAM "nmake" CACHE STRING
|
||||
"Program used to build from makefiles.")
|
||||
mark_as_advanced(CMAKE_MAKE_PROGRAM)
|
|
@ -0,0 +1,9 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
find_program(CMAKE_MAKE_PROGRAM
|
||||
NAMES ninja-build ninja samu
|
||||
NAMES_PER_DIR
|
||||
DOC "Program used to build from build.ninja files.")
|
||||
mark_as_advanced(CMAKE_MAKE_PROGRAM)
|
|
@ -0,0 +1,69 @@
|
|||
set(CMAKE_OBJC_COMPILER "@CMAKE_OBJC_COMPILER@")
|
||||
set(CMAKE_OBJC_COMPILER_ARG1 "@CMAKE_OBJC_COMPILER_ARG1@")
|
||||
set(CMAKE_OBJC_COMPILER_ID "@CMAKE_OBJC_COMPILER_ID@")
|
||||
set(CMAKE_OBJC_COMPILER_VERSION "@CMAKE_OBJC_COMPILER_VERSION@")
|
||||
set(CMAKE_OBJC_COMPILER_VERSION_INTERNAL "@CMAKE_OBJC_COMPILER_VERSION_INTERNAL@")
|
||||
set(CMAKE_OBJC_COMPILER_WRAPPER "@CMAKE_OBJC_COMPILER_WRAPPER@")
|
||||
set(CMAKE_OBJC_STANDARD_COMPUTED_DEFAULT "@CMAKE_OBJC_STANDARD_COMPUTED_DEFAULT@")
|
||||
set(CMAKE_OBJC_COMPILE_FEATURES "@CMAKE_OBJC_COMPILE_FEATURES@")
|
||||
set(CMAKE_OBJC90_COMPILE_FEATURES "@CMAKE_OBJC90_COMPILE_FEATURES@")
|
||||
set(CMAKE_OBJC99_COMPILE_FEATURES "@CMAKE_OBJC99_COMPILE_FEATURES@")
|
||||
set(CMAKE_OBJC11_COMPILE_FEATURES "@CMAKE_OBJC11_COMPILE_FEATURES@")
|
||||
|
||||
set(CMAKE_OBJC_PLATFORM_ID "@CMAKE_OBJC_PLATFORM_ID@")
|
||||
set(CMAKE_OBJC_SIMULATE_ID "@CMAKE_OBJC_SIMULATE_ID@")
|
||||
set(CMAKE_OBJC_COMPILER_FRONTEND_VARIANT "@CMAKE_OBJC_COMPILER_FRONTEND_VARIANT@")
|
||||
set(CMAKE_OBJC_SIMULATE_VERSION "@CMAKE_OBJC_SIMULATE_VERSION@")
|
||||
@_SET_CMAKE_OBJC_COMPILER_ARCHITECTURE_ID@
|
||||
@SET_CMAKE_XCODE_ARCHS@
|
||||
set(CMAKE_AR "@CMAKE_AR@")
|
||||
set(CMAKE_OBJC_COMPILER_AR "@CMAKE_OBJC_COMPILER_AR@")
|
||||
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
|
||||
set(CMAKE_OBJC_COMPILER_RANLIB "@CMAKE_OBJC_COMPILER_RANLIB@")
|
||||
set(CMAKE_LINKER "@CMAKE_LINKER@")
|
||||
set(CMAKE_MT "@CMAKE_MT@")
|
||||
set(CMAKE_COMPILER_IS_GNUOBJC @CMAKE_COMPILER_IS_GNUOBJC@)
|
||||
set(CMAKE_OBJC_COMPILER_LOADED 1)
|
||||
set(CMAKE_OBJC_COMPILER_WORKS @CMAKE_OBJC_COMPILER_WORKS@)
|
||||
set(CMAKE_OBJC_ABI_COMPILED @CMAKE_OBJC_ABI_COMPILED@)
|
||||
|
||||
set(CMAKE_OBJC_COMPILER_ENV_VAR "OBJC")
|
||||
|
||||
set(CMAKE_OBJC_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_OBJC_SOURCE_FILE_EXTENSIONS m)
|
||||
set(CMAKE_OBJC_IGNORE_EXTENSIONS h;H;o;O)
|
||||
set(CMAKE_OBJC_LINKER_PREFERENCE 5)
|
||||
|
||||
foreach (lang C CXX OBJCXX)
|
||||
foreach(extension IN LISTS CMAKE_OBJC_SOURCE_FILE_EXTENSIONS)
|
||||
if (CMAKE_${lang}_COMPILER_ID_RUN)
|
||||
list(REMOVE_ITEM CMAKE_${lang}_SOURCE_FILE_EXTENSIONS ${extension})
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
# Save compiler ABI information.
|
||||
set(CMAKE_OBJC_SIZEOF_DATA_PTR "@CMAKE_OBJC_SIZEOF_DATA_PTR@")
|
||||
set(CMAKE_OBJC_COMPILER_ABI "@CMAKE_OBJC_COMPILER_ABI@")
|
||||
set(CMAKE_OBJC_LIBRARY_ARCHITECTURE "@CMAKE_OBJC_LIBRARY_ARCHITECTURE@")
|
||||
|
||||
if(CMAKE_OBJC_SIZEOF_DATA_PTR)
|
||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_OBJC_SIZEOF_DATA_PTR}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_OBJC_COMPILER_ABI)
|
||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_OBJC_COMPILER_ABI}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_OBJC_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_OBJC_LIBRARY_ARCHITECTURE@")
|
||||
endif()
|
||||
|
||||
@CMAKE_OBJC_COMPILER_CUSTOM_CODE@
|
||||
@CMAKE_OBJC_SYSROOT_FLAG_CODE@
|
||||
@CMAKE_OBJC_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
|
||||
|
||||
set(CMAKE_OBJC_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_OBJC_IMPLICIT_INCLUDE_DIRECTORIES@")
|
||||
set(CMAKE_OBJC_IMPLICIT_LINK_LIBRARIES "@CMAKE_OBJC_IMPLICIT_LINK_LIBRARIES@")
|
||||
set(CMAKE_OBJC_IMPLICIT_LINK_DIRECTORIES "@CMAKE_OBJC_IMPLICIT_LINK_DIRECTORIES@")
|
||||
set(CMAKE_OBJC_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_OBJC_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
|
|
@ -0,0 +1,20 @@
|
|||
#ifdef __cplusplus
|
||||
# error "A C++ compiler has been selected for Objective-C."
|
||||
#endif
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
#include "CMakeCompilerABI.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int require = 0;
|
||||
require += info_sizeof_dptr[argc];
|
||||
#if defined(ABI_ID)
|
||||
require += info_abi[argc];
|
||||
#endif
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
#ifdef __cplusplus
|
||||
# error "An Objective-C++ compiler has been selected for Objective-C."
|
||||
#endif
|
||||
|
||||
@CMAKE_OBJC_COMPILER_ID_CONTENT@
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
||||
#ifdef SIMULATE_ID
|
||||
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
|
||||
#endif
|
||||
|
||||
#ifdef __QNXNTO__
|
||||
char const* qnxnto = "INFO" ":" "qnxnto[]";
|
||||
#endif
|
||||
|
||||
@CMAKE_OBJC_COMPILER_ID_PLATFORM_CONTENT@
|
||||
@CMAKE_OBJC_COMPILER_ID_ERROR_FOR_TEST@
|
||||
|
||||
#if !defined(__STDC__)
|
||||
# if (defined(_MSC_VER) && !defined(__clang__)) \
|
||||
|| (defined(__ibmxl__) || defined(__IBMC__))
|
||||
# define C_DIALECT "90"
|
||||
# else
|
||||
# define C_DIALECT
|
||||
# endif
|
||||
#elif __STDC_VERSION__ >= 201000L
|
||||
# define C_DIALECT "11"
|
||||
#elif __STDC_VERSION__ >= 199901L
|
||||
# define C_DIALECT "99"
|
||||
#else
|
||||
# define C_DIALECT "90"
|
||||
#endif
|
||||
const char* info_language_dialect_default =
|
||||
"INFO" ":" "dialect_default[" C_DIALECT "]";
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int require = 0;
|
||||
require += info_compiler[argc];
|
||||
require += info_platform[argc];
|
||||
require += info_arch[argc];
|
||||
#ifdef COMPILER_VERSION_MAJOR
|
||||
require += info_version[argc];
|
||||
#endif
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
require += info_version_internal[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_ID
|
||||
require += info_simulate[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
require += info_simulate_version[argc];
|
||||
#endif
|
||||
require += info_language_dialect_default[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
|
@ -0,0 +1,193 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
|
||||
# This file sets the basic flags for the Objective-C language in CMake.
|
||||
# It also loads the available platform file for the system-compiler
|
||||
# if it exists.
|
||||
# It also loads a system - compiler - processor (or target hardware)
|
||||
# specific file, which is mainly useful for crosscompiling and embedded systems.
|
||||
|
||||
include(CMakeLanguageInformation)
|
||||
|
||||
# some compilers use different extensions (e.g. sdcc uses .rel)
|
||||
# so set the extension here first so it can be overridden by the compiler specific file
|
||||
set(CMAKE_OBJC_OUTPUT_EXTENSION .o)
|
||||
|
||||
if(NOT CMAKE_INCLUDE_FLAG_OBJC)
|
||||
set(CMAKE_INCLUDE_FLAG_OBJC ${CMAKE_INCLUDE_FLAG_C})
|
||||
endif()
|
||||
|
||||
set(_INCLUDED_FILE 0)
|
||||
|
||||
# Load compiler-specific information.
|
||||
if(CMAKE_OBJC_COMPILER_ID)
|
||||
include(Compiler/${CMAKE_OBJC_COMPILER_ID}-OBJC OPTIONAL)
|
||||
endif()
|
||||
|
||||
set(CMAKE_BASE_NAME)
|
||||
get_filename_component(CMAKE_BASE_NAME "${CMAKE_OBJC_COMPILER}" NAME_WE)
|
||||
if(CMAKE_COMPILER_IS_GNUOBJC)
|
||||
set(CMAKE_BASE_NAME gcc)
|
||||
endif()
|
||||
|
||||
|
||||
# load a hardware specific file, mostly useful for embedded compilers
|
||||
if(CMAKE_SYSTEM_PROCESSOR)
|
||||
if(CMAKE_OBJC_COMPILER_ID)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_OBJC_COMPILER_ID}-OBJC-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif()
|
||||
if (NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
|
||||
# load the system- and compiler specific files
|
||||
if(CMAKE_OBJC_COMPILER_ID)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_OBJC_COMPILER_ID}-OBJC
|
||||
OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif()
|
||||
if (NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_BASE_NAME}
|
||||
OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif ()
|
||||
|
||||
# load any compiler-wrapper specific information
|
||||
if (CMAKE_OBJC_COMPILER_WRAPPER)
|
||||
__cmake_include_compiler_wrapper(OBJC)
|
||||
endif ()
|
||||
|
||||
# We specify the compiler information in the system file for some
|
||||
# platforms, but this language may not have been enabled when the file
|
||||
# was first included. Include it again to get the language info.
|
||||
# Remove this when all compiler info is removed from system files.
|
||||
if (NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
|
||||
endif ()
|
||||
|
||||
if(CMAKE_OBJC_SIZEOF_DATA_PTR)
|
||||
foreach(f ${CMAKE_OBJC_ABI_FILES})
|
||||
include(${f})
|
||||
endforeach()
|
||||
unset(CMAKE_OBJC_ABI_FILES)
|
||||
endif()
|
||||
|
||||
# This should be included before the _INIT variables are
|
||||
# used to initialize the cache. Since the rule variables
|
||||
# have if blocks on them, users can still define them here.
|
||||
# But, it should still be after the platform file so changes can
|
||||
# be made to those values.
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE)
|
||||
# Save the full path of the file so try_compile can use it.
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE_OBJC)
|
||||
# Save the full path of the file so try_compile can use it.
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE_OBJC} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE_OBJC "${_override}")
|
||||
endif()
|
||||
|
||||
|
||||
# for most systems a module is the same as a shared library
|
||||
# so unless the variable CMAKE_MODULE_EXISTS is set just
|
||||
# copy the values from the LIBRARY variables
|
||||
if(NOT CMAKE_MODULE_EXISTS)
|
||||
set(CMAKE_SHARED_MODULE_OBJC_FLAGS ${CMAKE_SHARED_LIBRARY_OBJC_FLAGS})
|
||||
set(CMAKE_SHARED_MODULE_CREATE_OBJC_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_OBJC_FLAGS})
|
||||
endif()
|
||||
|
||||
set(CMAKE_OBJC_FLAGS_INIT "$ENV{OBJCFLAGS} ${CMAKE_OBJC_FLAGS_INIT}")
|
||||
|
||||
cmake_initialize_per_config_variable(CMAKE_OBJC_FLAGS "Flags used by the Objective-C compiler")
|
||||
|
||||
if(CMAKE_OBJC_STANDARD_LIBRARIES_INIT)
|
||||
set(CMAKE_OBJC_STANDARD_LIBRARIES "${CMAKE_OBJC_STANDARD_LIBRARIES_INIT}"
|
||||
CACHE STRING "Libraries linked by default with all Objective-C applications.")
|
||||
mark_as_advanced(CMAKE_OBJC_STANDARD_LIBRARIES)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_OBJC_COMPILER_LAUNCHER AND DEFINED ENV{CMAKE_OBJC_COMPILER_LAUNCHER})
|
||||
set(CMAKE_OBJC_COMPILER_LAUNCHER "$ENV{CMAKE_OBJC_COMPILER_LAUNCHER}"
|
||||
CACHE STRING "Compiler launcher for OBJC.")
|
||||
endif()
|
||||
|
||||
include(CMakeCommonLanguageInclude)
|
||||
|
||||
# now define the following rule variables
|
||||
|
||||
# CMAKE_OBJC_CREATE_SHARED_LIBRARY
|
||||
# CMAKE_OBJC_CREATE_SHARED_MODULE
|
||||
# CMAKE_OBJC_COMPILE_OBJECT
|
||||
# CMAKE_OBJC_LINK_EXECUTABLE
|
||||
|
||||
# variables supplied by the generator at use time
|
||||
# <TARGET>
|
||||
# <TARGET_BASE> the target without the suffix
|
||||
# <OBJECTS>
|
||||
# <OBJECT>
|
||||
# <LINK_LIBRARIES>
|
||||
# <FLAGS>
|
||||
# <LINK_FLAGS>
|
||||
|
||||
# Objective-C compiler information
|
||||
# <CMAKE_OBJC_COMPILER>
|
||||
# <CMAKE_SHARED_LIBRARY_CREATE_OBJC_FLAGS>
|
||||
# <CMAKE_SHARED_MODULE_CREATE_OBJC_FLAGS>
|
||||
# <CMAKE_OBJC_LINK_FLAGS>
|
||||
|
||||
# Static library tools
|
||||
# <CMAKE_AR>
|
||||
# <CMAKE_RANLIB>
|
||||
|
||||
|
||||
# create an Objective-C shared library
|
||||
if(NOT CMAKE_OBJC_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_OBJC_CREATE_SHARED_LIBRARY
|
||||
"<CMAKE_OBJC_COMPILER> <CMAKE_SHARED_LIBRARY_OBJC_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_OBJC_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
# create an Objective-C shared module just copy the shared library rule
|
||||
if(NOT CMAKE_OBJC_CREATE_SHARED_MODULE)
|
||||
set(CMAKE_OBJC_CREATE_SHARED_MODULE ${CMAKE_OBJC_CREATE_SHARED_LIBRARY})
|
||||
endif()
|
||||
|
||||
# Create an static archive incrementally for large object file counts.
|
||||
# If CMAKE_OBJC_CREATE_STATIC_LIBRARY is set it will override these.
|
||||
if(NOT DEFINED CMAKE_OBJC_ARCHIVE_CREATE)
|
||||
set(CMAKE_OBJC_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_OBJC_ARCHIVE_APPEND)
|
||||
set(CMAKE_OBJC_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_OBJC_ARCHIVE_FINISH)
|
||||
set(CMAKE_OBJC_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
|
||||
endif()
|
||||
|
||||
# compile an Objective-C file into an object file
|
||||
if(NOT CMAKE_OBJC_COMPILE_OBJECT)
|
||||
set(CMAKE_OBJC_COMPILE_OBJECT
|
||||
"<CMAKE_OBJC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x objective-c -o <OBJECT> -c <SOURCE>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_OBJC_LINK_EXECUTABLE)
|
||||
set(CMAKE_OBJC_LINK_EXECUTABLE
|
||||
"<CMAKE_OBJC_COMPILER> <FLAGS> <CMAKE_OBJC_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_OBJC_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_OBJC_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_OBJC_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_OBJC_FLAG_SEP)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_OBJC_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_OBJC_FLAG_SEP})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RPATH_LINK_OBJC_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RPATH_LINK_OBJC_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_OBJC_FLAG})
|
||||
endif()
|
||||
|
||||
set(CMAKE_OBJC_INFORMATION_LOADED 1)
|
|
@ -0,0 +1,79 @@
|
|||
set(CMAKE_OBJCXX_COMPILER "@CMAKE_OBJCXX_COMPILER@")
|
||||
set(CMAKE_OBJCXX_COMPILER_ARG1 "@CMAKE_OBJCXX_COMPILER_ARG1@")
|
||||
set(CMAKE_OBJCXX_COMPILER_ID "@CMAKE_OBJCXX_COMPILER_ID@")
|
||||
set(CMAKE_OBJCXX_COMPILER_VERSION "@CMAKE_OBJCXX_COMPILER_VERSION@")
|
||||
set(CMAKE_OBJCXX_COMPILER_VERSION_INTERNAL "@CMAKE_OBJCXX_COMPILER_VERSION_INTERNAL@")
|
||||
set(CMAKE_OBJCXX_COMPILER_WRAPPER "@CMAKE_OBJCXX_COMPILER_WRAPPER@")
|
||||
set(CMAKE_OBJCXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_OBJCXX_STANDARD_COMPUTED_DEFAULT@")
|
||||
set(CMAKE_OBJCXX_COMPILE_FEATURES "@CMAKE_OBJCXX_COMPILE_FEATURES@")
|
||||
set(CMAKE_OBJCXX98_COMPILE_FEATURES "@CMAKE_OBJCXX98_COMPILE_FEATURES@")
|
||||
set(CMAKE_OBJCXX11_COMPILE_FEATURES "@CMAKE_OBJCXX11_COMPILE_FEATURES@")
|
||||
set(CMAKE_OBJCXX14_COMPILE_FEATURES "@CMAKE_OBJCXX14_COMPILE_FEATURES@")
|
||||
set(CMAKE_OBJCXX17_COMPILE_FEATURES "@CMAKE_OBJCXX17_COMPILE_FEATURES@")
|
||||
set(CMAKE_OBJCXX20_COMPILE_FEATURES "@CMAKE_OBJCXX20_COMPILE_FEATURES@")
|
||||
|
||||
set(CMAKE_OBJCXX_PLATFORM_ID "@CMAKE_OBJCXX_PLATFORM_ID@")
|
||||
set(CMAKE_OBJCXX_SIMULATE_ID "@CMAKE_OBJCXX_SIMULATE_ID@")
|
||||
set(CMAKE_OBJCXX_COMPILER_FRONTEND_VARIANT "@CMAKE_OBJCXX_COMPILER_FRONTEND_VARIANT@")
|
||||
set(CMAKE_OBJCXX_SIMULATE_VERSION "@CMAKE_OBJCXX_SIMULATE_VERSION@")
|
||||
@_SET_CMAKE_OBJCXX_COMPILER_ARCHITECTURE_ID@
|
||||
@SET_CMAKE_XCODE_ARCHS@
|
||||
set(CMAKE_AR "@CMAKE_AR@")
|
||||
set(CMAKE_OBJCXX_COMPILER_AR "@CMAKE_OBJCXX_COMPILER_AR@")
|
||||
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
|
||||
set(CMAKE_OBJCXX_COMPILER_RANLIB "@CMAKE_OBJCXX_COMPILER_RANLIB@")
|
||||
set(CMAKE_LINKER "@CMAKE_LINKER@")
|
||||
set(CMAKE_MT "@CMAKE_MT@")
|
||||
set(CMAKE_COMPILER_IS_GNUOBJCXX @CMAKE_COMPILER_IS_GNUOBJCXX@)
|
||||
set(CMAKE_OBJCXX_COMPILER_LOADED 1)
|
||||
set(CMAKE_OBJCXX_COMPILER_WORKS @CMAKE_OBJCXX_COMPILER_WORKS@)
|
||||
set(CMAKE_OBJCXX_ABI_COMPILED @CMAKE_OBJCXX_ABI_COMPILED@)
|
||||
|
||||
set(CMAKE_OBJCXX_COMPILER_ENV_VAR "OBJCXX")
|
||||
|
||||
set(CMAKE_OBJCXX_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_OBJCXX_SOURCE_FILE_EXTENSIONS M;m;mm)
|
||||
set(CMAKE_OBJCXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O)
|
||||
|
||||
if (CMAKE_OBJC_COMPILER_ID_RUN)
|
||||
foreach(extension IN LISTS CMAKE_OBJC_SOURCE_FILE_EXTENSIONS)
|
||||
list(REMOVE_ITEM CMAKE_OBJCXX_SOURCE_FILE_EXTENSIONS ${extension})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
foreach (lang C CXX OBJC)
|
||||
foreach(extension IN LISTS CMAKE_OBJCXX_SOURCE_FILE_EXTENSIONS)
|
||||
if (CMAKE_${lang}_COMPILER_ID_RUN)
|
||||
list(REMOVE_ITEM CMAKE_${lang}_SOURCE_FILE_EXTENSIONS ${extension})
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
set(CMAKE_OBJCXX_LINKER_PREFERENCE 25)
|
||||
set(CMAKE_OBJCXX_LINKER_PREFERENCE_PROPAGATES 1)
|
||||
|
||||
# Save compiler ABI information.
|
||||
set(CMAKE_OBJCXX_SIZEOF_DATA_PTR "@CMAKE_OBJCXX_SIZEOF_DATA_PTR@")
|
||||
set(CMAKE_OBJCXX_COMPILER_ABI "@CMAKE_OBJCXX_COMPILER_ABI@")
|
||||
set(CMAKE_OBJCXX_LIBRARY_ARCHITECTURE "@CMAKE_OBJCXX_LIBRARY_ARCHITECTURE@")
|
||||
|
||||
if(CMAKE_OBJCXX_SIZEOF_DATA_PTR)
|
||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_OBJCXX_SIZEOF_DATA_PTR}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_OBJCXX_COMPILER_ABI)
|
||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_OBJCXX_COMPILER_ABI}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_OBJCXX_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_OBJCXX_LIBRARY_ARCHITECTURE@")
|
||||
endif()
|
||||
|
||||
@CMAKE_OBJCXX_COMPILER_CUSTOM_CODE@
|
||||
@CMAKE_OBJCXX_SYSROOT_FLAG_CODE@
|
||||
@CMAKE_OBJCXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
|
||||
|
||||
set(CMAKE_OBJCXX_IMPLICIT_INCLUDE_DIRECTORIES "@CMAKE_OBJCXX_IMPLICIT_INCLUDE_DIRECTORIES@")
|
||||
set(CMAKE_OBJCXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_OBJCXX_IMPLICIT_LINK_LIBRARIES@")
|
||||
set(CMAKE_OBJCXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_OBJCXX_IMPLICIT_LINK_DIRECTORIES@")
|
||||
set(CMAKE_OBJCXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_OBJCXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue