mirror of
https://github.com/reactos/reactos.git
synced 2024-12-25 16:50:57 +00:00
CORE-14513 [CMAKE] Remove modules that are shipped with cmake (#575)
* Remove unused cmake modules - Both are unedited versions of modules provided by cmake itself * Remove Compiler/GNU.cmake - Only chang was various _INIT flags, which are handled via CMAKE_USER_MAKE_RULES_OVERRIDE instead * Remove Platform/Windows.cmake - There's no clear explination for this file being in reactos and is simply an old version of the one in cmake * Remove Platform/Windows-MSVC.cmake - _INIT variable changes moved to overrides-msvc.cmake Remove /implib from link commands * Remove CMakeDetermineASMCompiler.cmake - Only change from 3.2 is the addition of a compiler list for the generic ASM dialect, but toolchain files explicitly set a compiler so the list is never used
This commit is contained in:
parent
2eb7ddd598
commit
8cd5c4e7bd
12 changed files with 35 additions and 1187 deletions
|
@ -9,9 +9,6 @@ endif()
|
|||
# Don't escape preprocessor definition values added via add_definitions
|
||||
cmake_policy(SET CMP0005 OLD)
|
||||
|
||||
# Shadow cmake provided modules
|
||||
cmake_policy(SET CMP0017 OLD)
|
||||
|
||||
# Honor CMAKE_SHARED_LIBRARY_<Lang>_FLAGS variable.
|
||||
cmake_policy(SET CMP0018 OLD)
|
||||
|
||||
|
@ -68,12 +65,6 @@ if(MSVC_IDE)
|
|||
add_compile_flags("/MP")
|
||||
endif()
|
||||
|
||||
# We don't need CMake importlib handling.
|
||||
# FIXME: Remove the MSVC_IDE condition when the upcoming RosBE lands.
|
||||
if(NOT MSVC_IDE)
|
||||
unset(CMAKE_IMPORT_LIBRARY_SUFFIX)
|
||||
endif()
|
||||
|
||||
# Bison and Flex support
|
||||
# include(sdk/cmake/bison-flex.cmake)
|
||||
|
||||
|
@ -115,6 +106,11 @@ if(NOT CMAKE_CROSSCOMPILING)
|
|||
endif()
|
||||
|
||||
else()
|
||||
# We don't need CMake importlib handling.
|
||||
# FIXME: Remove the MSVC_IDE condition when the upcoming RosBE lands.
|
||||
if(NOT MSVC_IDE)
|
||||
unset(CMAKE_IMPORT_LIBRARY_SUFFIX)
|
||||
endif()
|
||||
|
||||
if(NEW_STYLE_BUILD)
|
||||
include(sdk/cmake/host-tools.cmake)
|
||||
|
|
6
overrides-gcc.cmake
Normal file
6
overrides-gcc.cmake
Normal file
|
@ -0,0 +1,6 @@
|
|||
foreach(lang C CXX ASM)
|
||||
set(CMAKE_${lang}_FLAGS_DEBUG "")
|
||||
set(CMAKE_${lang}_FLAGS_MINSIZEREL "-Os -DNDEBUG")
|
||||
set(CMAKE_${lang}_FLAGS_RELEASE "")
|
||||
set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
|
||||
endforeach()
|
14
overrides-msvc.cmake
Normal file
14
overrides-msvc.cmake
Normal file
|
@ -0,0 +1,14 @@
|
|||
set(CMAKE_CXX_FLAGS_DEBUG_INIT "")
|
||||
set(CMAKE_CXX_FLAGS_INIT "")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE_INIT "")
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "")
|
||||
set(CMAKE_C_FLAGS_DEBUG_INIT "")
|
||||
set(CMAKE_C_FLAGS_INIT "")
|
||||
set(CMAKE_C_FLAGS_RELEASE_INIT "")
|
||||
set(CMAKE_C_STANDARD_LIBRARIES_INIT "")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT "/debug")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT "/debug")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug")
|
|
@ -1,346 +0,0 @@
|
|||
|
||||
#=============================================================================
|
||||
# Copyright 2007-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS 2.8.10)
|
||||
|
||||
# determine the compiler to use for ASM programs
|
||||
|
||||
IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
||||
# prefer the environment variable ASM
|
||||
IF($ENV{ASM${ASM_DIALECT}} MATCHES ".+")
|
||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT "$ENV{ASM${ASM_DIALECT}}")
|
||||
ENDIF($ENV{ASM${ASM_DIALECT}} MATCHES ".+")
|
||||
|
||||
# finally list compilers to try
|
||||
IF("ASM${ASM_DIALECT}" STREQUAL "ASM") # the generic assembler support
|
||||
|
||||
IF(CMAKE_ASM_COMPILER_INIT)
|
||||
SET(CMAKE_ASM_COMPILER_LIST ${CMAKE_ASM_COMPILER_INIT})
|
||||
ELSE(CMAKE_ASM_COMPILER_INIT)
|
||||
|
||||
IF(CMAKE_C_COMPILER)
|
||||
SET(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "The ASM compiler")
|
||||
SET(CMAKE_ASM_COMPILER_ID "${CMAKE_C_COMPILER_ID}")
|
||||
ELSEIF(CMAKE_CXX_COMPILER)
|
||||
SET(CMAKE_ASM_COMPILER "${CMAKE_CXX_COMPILER}" CACHE FILEPATH "The ASM compiler")
|
||||
SET(CMAKE_ASM_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}")
|
||||
ELSE(CMAKE_CXX_COMPILER)
|
||||
# List all default C and CXX compilers
|
||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc
|
||||
${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ CC aCC cl bcc xlC)
|
||||
ENDIF(CMAKE_C_COMPILER)
|
||||
|
||||
ENDIF(CMAKE_ASM_COMPILER_INIT)
|
||||
|
||||
|
||||
ELSE("ASM${ASM_DIALECT}" STREQUAL "ASM") # some specific assembler "dialect"
|
||||
|
||||
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
|
||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT})
|
||||
ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
|
||||
MESSAGE(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT must be preset !")
|
||||
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
|
||||
|
||||
ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM")
|
||||
|
||||
|
||||
# Find the compiler.
|
||||
IF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
|
||||
FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} PATHS ${_CMAKE_USER_C_COMPILER_PATH} ${_CMAKE_USER_CXX_COMPILER_PATH} DOC "Assembler" NO_DEFAULT_PATH)
|
||||
ENDIF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
|
||||
FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} PATHS ${_CMAKE_TOOLCHAIN_LOCATION} DOC "Assembler")
|
||||
|
||||
ELSE(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
||||
|
||||
# we only get here if CMAKE_ASM${ASM_DIALECT}_COMPILER was specified using -D or a pre-made CMakeCache.txt
|
||||
# (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
|
||||
#
|
||||
# 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"
|
||||
GET_FILENAME_COMPONENT(_CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH)
|
||||
IF(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH)
|
||||
FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER})
|
||||
MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
|
||||
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
|
||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER ${CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH} CACHE FILEPATH "Assembler" FORCE)
|
||||
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
|
||||
ENDIF(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH)
|
||||
ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
||||
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 (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
||||
|
||||
|
||||
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 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 TI_DSP )
|
||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI_DSP "-h")
|
||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI_DSP "Texas Instruments")
|
||||
|
||||
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS VISUAL)
|
||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_VISUAL "/?")
|
||||
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_VISUAL "Microsoft Corporation")
|
||||
|
||||
INCLUDE(CMakeDetermineCompilerId)
|
||||
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT})
|
||||
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||
MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
|
||||
ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||
MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown")
|
||||
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||
|
||||
|
||||
|
||||
# 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 lile
|
||||
# "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 (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||
|
||||
# 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 (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||
|
||||
# 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 (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||
|
||||
|
||||
INCLUDE(CMakeFindBinUtils)
|
||||
|
||||
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(CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
||||
MESSAGE(STATUS "Didn't find assembler")
|
||||
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
||||
|
||||
|
||||
SET(_CMAKE_ASM_COMPILER "${CMAKE_ASM${ASM_DIALECT}_COMPILER}")
|
||||
SET(_CMAKE_ASM_COMPILER_ID "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
|
||||
SET(_CMAKE_ASM_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1}")
|
||||
SET(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}")
|
||||
|
||||
# configure variables set in this file for fast reload later on
|
||||
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeASMCompiler.cmake.in
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeASM${ASM_DIALECT}Compiler.cmake IMMEDIATE @ONLY)
|
||||
|
||||
SET(_CMAKE_ASM_COMPILER)
|
||||
SET(_CMAKE_ASM_COMPILER_ARG1)
|
||||
SET(_CMAKE_ASM_COMPILER_ENV_VAR)
|
||||
|
||||
else()
|
||||
|
||||
# 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($ENV{ASM${ASM_DIALECT}} MATCHES ".+")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT "$ENV{ASM${ASM_DIALECT}}")
|
||||
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_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "The ASM compiler")
|
||||
set(CMAKE_ASM_COMPILER_ID "${CMAKE_C_COMPILER_ID}")
|
||||
elseif(CMAKE_CXX_COMPILER)
|
||||
set(CMAKE_ASM_COMPILER "${CMAKE_CXX_COMPILER}" CACHE FILEPATH "The ASM compiler")
|
||||
set(CMAKE_ASM_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}")
|
||||
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)
|
||||
message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT must be preset !")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Find the compiler.
|
||||
_cmake_find_compiler(ASM${ASM_DIALECT})
|
||||
|
||||
else()
|
||||
|
||||
# we only get here if CMAKE_ASM${ASM_DIALECT}_COMPILER was specified using -D or a pre-made CMakeCache.txt
|
||||
# (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE
|
||||
#
|
||||
# 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"
|
||||
get_filename_component(_CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH)
|
||||
if(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH)
|
||||
find_program(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER})
|
||||
mark_as_advanced(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
|
||||
if(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH)
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER ${CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH} CACHE FILEPATH "Assembler" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
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 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_DSP )
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI_DSP "-h")
|
||||
set(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI_DSP "Texas Instruments")
|
||||
|
||||
include(CMakeDetermineCompilerId)
|
||||
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT})
|
||||
|
||||
endif()
|
||||
|
||||
if(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
|
||||
message(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
|
||||
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 lile
|
||||
# "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 ()
|
||||
|
||||
|
||||
include(CMakeFindBinUtils)
|
||||
|
||||
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()
|
||||
|
||||
|
||||
set(_CMAKE_ASM_COMPILER "${CMAKE_ASM${ASM_DIALECT}_COMPILER}")
|
||||
set(_CMAKE_ASM_COMPILER_ID "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
|
||||
set(_CMAKE_ASM_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1}")
|
||||
set(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}")
|
||||
|
||||
# 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 IMMEDIATE @ONLY)
|
||||
|
||||
set(_CMAKE_ASM_COMPILER)
|
||||
set(_CMAKE_ASM_COMPILER_ARG1)
|
||||
set(_CMAKE_ASM_COMPILER_ENV_VAR)
|
||||
|
||||
endif()
|
||||
|
|
@ -1,315 +0,0 @@
|
|||
|
||||
#=============================================================================
|
||||
# Copyright 2007-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# 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(CMAKE_${lang}_FLAGS)
|
||||
SET(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${flagvar}})
|
||||
ENDIF(CMAKE_${lang}_FLAGS)
|
||||
STRING(REGEX 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_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang})
|
||||
|
||||
# Try building with no extra flags and then try each set
|
||||
# of helper flags. Stop when the compiler is identified.
|
||||
FOREACH(flags "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
|
||||
IF(NOT CMAKE_${lang}_COMPILER_ID)
|
||||
CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}")
|
||||
FOREACH(file ${COMPILER_${lang}_PRODUCED_FILES})
|
||||
CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}")
|
||||
ENDFOREACH(file)
|
||||
ENDIF(NOT CMAKE_${lang}_COMPILER_ID)
|
||||
ENDFOREACH(flags)
|
||||
|
||||
# If the compiler is still unknown, try to query its vendor.
|
||||
IF(NOT CMAKE_${lang}_COMPILER_ID)
|
||||
CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang})
|
||||
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(NOT CMAKE_EXECUTABLE_FORMAT)
|
||||
|
||||
# Display the final identification result.
|
||||
IF(CMAKE_${lang}_COMPILER_ID)
|
||||
MESSAGE(STATUS "The ${lang} compiler identification is "
|
||||
"${CMAKE_${lang}_COMPILER_ID}")
|
||||
ELSE(CMAKE_${lang}_COMPILER_ID)
|
||||
MESSAGE(STATUS "The ${lang} compiler identification is unknown")
|
||||
ENDIF(CMAKE_${lang}_COMPILER_ID)
|
||||
|
||||
SET(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE)
|
||||
SET(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE)
|
||||
SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
|
||||
PARENT_SCOPE)
|
||||
ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Function to write the compiler id source file.
|
||||
FUNCTION(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src)
|
||||
FILE(READ ${CMAKE_ROOT}/Modules/${src}.in ID_CONTENT_IN)
|
||||
STRING(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY)
|
||||
FILE(WRITE ${CMAKE_${lang}_COMPILER_ID_DIR}/${src} "${ID_CONTENT_OUT}")
|
||||
ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_WRITE)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Function to build the compiler id source file and look for output
|
||||
# files.
|
||||
FUNCTION(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src)
|
||||
# Create a clean working directory.
|
||||
FILE(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||
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: ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
|
||||
Id flags: ${testflags}
|
||||
")
|
||||
|
||||
# Compile the compiler identification source.
|
||||
IF(COMMAND EXECUTE_PROCESS)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_${lang}_COMPILER}
|
||||
${CMAKE_${lang}_COMPILER_ID_ARG1}
|
||||
${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
|
||||
${testflags}
|
||||
"${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
|
||||
)
|
||||
ELSE(COMMAND EXECUTE_PROCESS)
|
||||
EXEC_PROGRAM(
|
||||
${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_DIR}
|
||||
ARGS ${CMAKE_${lang}_COMPILER_ID_ARG1}
|
||||
${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
|
||||
${testflags}
|
||||
\"${src}\"
|
||||
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
|
||||
RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT
|
||||
)
|
||||
ENDIF(COMMAND EXECUTE_PROCESS)
|
||||
|
||||
# Check the result of compilation.
|
||||
IF(CMAKE_${lang}_COMPILER_ID_RESULT)
|
||||
# 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(NOT CMAKE_${lang}_COMPILER_ID_ALLOW_FAIL)
|
||||
|
||||
# No output files should be inspected.
|
||||
SET(COMPILER_${lang}_PRODUCED_FILES)
|
||||
ELSE(CMAKE_${lang}_COMPILER_ID_RESULT)
|
||||
# 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.
|
||||
FILE(GLOB COMPILER_${lang}_PRODUCED_FILES
|
||||
RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR}
|
||||
${CMAKE_${lang}_COMPILER_ID_DIR}/*)
|
||||
LIST(REMOVE_ITEM COMPILER_${lang}_PRODUCED_FILES "${src}")
|
||||
FOREACH(file ${COMPILER_${lang}_PRODUCED_FILES})
|
||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Compilation of the ${lang} compiler identification source \""
|
||||
"${src}\" produced \"${file}\"\n\n")
|
||||
ENDFOREACH(file)
|
||||
|
||||
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(NOT COMPILER_${lang}_PRODUCED_FILES)
|
||||
ENDIF(CMAKE_${lang}_COMPILER_ID_RESULT)
|
||||
|
||||
# Return the files produced by the compilation.
|
||||
SET(COMPILER_${lang}_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE)
|
||||
ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 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(PLATFORM_ID)
|
||||
FILE(STRINGS ${file}
|
||||
CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 3 REGEX "INFO:")
|
||||
SET(HAVE_COMPILER_TWICE 0)
|
||||
FOREACH(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
|
||||
IF("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*")
|
||||
IF(COMPILER_ID)
|
||||
SET(COMPILER_ID_TWICE 1)
|
||||
ENDIF(COMPILER_ID)
|
||||
STRING(REGEX REPLACE ".*INFO:compiler\\[([^]]*)\\].*" "\\1"
|
||||
COMPILER_ID "${info}")
|
||||
ENDIF("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*")
|
||||
IF("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*")
|
||||
STRING(REGEX REPLACE ".*INFO:platform\\[([^]]*)\\].*" "\\1"
|
||||
PLATFORM_ID "${info}")
|
||||
ENDIF("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*")
|
||||
IF("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*")
|
||||
STRING(REGEX REPLACE ".*INFO:arch\\[([^]]*)\\].*" "\\1"
|
||||
ARCHITECTURE_ID "${info}")
|
||||
ENDIF("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*")
|
||||
ENDFOREACH(info)
|
||||
|
||||
# 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(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}")
|
||||
ENDIF(COMPILER_ID AND NOT COMPILER_ID_TWICE)
|
||||
|
||||
# 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(CMAKE_${lang}_COMPILER_ID)
|
||||
# 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(CMAKE_${lang}_COMPILER_ID)
|
||||
ENDIF(NOT CMAKE_${lang}_COMPILER_ID)
|
||||
|
||||
# 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("${CMAKE_EXECUTABLE_MAGIC}" STREQUAL "7f454c46")
|
||||
|
||||
# # COFF (.exe) files start with "MZ"
|
||||
# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "4d5a....")
|
||||
# SET(CMAKE_EXECUTABLE_FORMAT "COFF" CACHE STRING "Executable file format")
|
||||
# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "4d5a....")
|
||||
#
|
||||
# # Mach-O files start with CAFEBABE or FEEDFACE, according to http://radio.weblogs.com/0100490/2003/01/28.html
|
||||
# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "cafebabe")
|
||||
# SET(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format")
|
||||
# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "cafebabe")
|
||||
# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface")
|
||||
# SET(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format")
|
||||
# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface")
|
||||
|
||||
ENDIF(NOT CMAKE_EXECUTABLE_FORMAT)
|
||||
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(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}"
|
||||
PARENT_SCOPE)
|
||||
SET(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE)
|
||||
ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 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)
|
||||
|
||||
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_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang})
|
||||
FILE(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
|
||||
ENDIF(NOT CMAKE_${lang}_COMPILER_ID_DIR)
|
||||
|
||||
|
||||
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}
|
||||
${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST}
|
||||
${flags}
|
||||
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
|
||||
OUTPUT_VARIABLE output ERROR_VARIABLE output
|
||||
RESULT_VARIABLE result
|
||||
TIMEOUT 10
|
||||
)
|
||||
|
||||
IF("${lang}" STREQUAL "ASM")
|
||||
MESSAGE(STATUS "Checked for ${vendor}")
|
||||
MESSAGE(STATUS " Output: -${output}-")
|
||||
MESSAGE(STATUS " Result: -${result}-")
|
||||
ENDIF("${lang}" STREQUAL "ASM")
|
||||
|
||||
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)
|
||||
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()
|
||||
ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR)
|
|
@ -1,157 +0,0 @@
|
|||
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
|
||||
#
|
||||
# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
|
||||
# parsing the arguments given to that macro or function.
|
||||
# It processes the arguments and defines a set of variables which hold the
|
||||
# values of the respective options.
|
||||
#
|
||||
# The <options> argument contains all options for the respective macro,
|
||||
# i.e. keywords which can be used when calling the macro without any value
|
||||
# following, like e.g. the OPTIONAL keyword of the install() command.
|
||||
#
|
||||
# The <one_value_keywords> argument contains all keywords for this macro
|
||||
# which are followed by one value, like e.g. DESTINATION keyword of the
|
||||
# install() command.
|
||||
#
|
||||
# The <multi_value_keywords> argument contains all keywords for this macro
|
||||
# which can be followed by more than one value, like e.g. the TARGETS or
|
||||
# FILES keywords of the install() command.
|
||||
#
|
||||
# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
|
||||
# keywords listed in <options>, <one_value_keywords> and
|
||||
# <multi_value_keywords> a variable composed of the given <prefix>
|
||||
# followed by "_" and the name of the respective keyword.
|
||||
# These variables will then hold the respective value from the argument list.
|
||||
# For the <options> keywords this will be TRUE or FALSE.
|
||||
#
|
||||
# All remaining arguments are collected in a variable
|
||||
# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
|
||||
# your macro was called with unrecognized parameters.
|
||||
#
|
||||
# As an example here a my_install() macro, which takes similar arguments as the
|
||||
# real install() command:
|
||||
#
|
||||
# function(MY_INSTALL)
|
||||
# set(options OPTIONAL FAST)
|
||||
# set(oneValueArgs DESTINATION RENAME)
|
||||
# set(multiValueArgs TARGETS CONFIGURATIONS)
|
||||
# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
# ...
|
||||
#
|
||||
# Assume my_install() has been called like this:
|
||||
# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
|
||||
#
|
||||
# After the cmake_parse_arguments() call the macro will have set the following
|
||||
# variables:
|
||||
# MY_INSTALL_OPTIONAL = TRUE
|
||||
# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
|
||||
# MY_INSTALL_DESTINATION = "bin"
|
||||
# MY_INSTALL_RENAME = "" (was not used)
|
||||
# MY_INSTALL_TARGETS = "foo;bar"
|
||||
# MY_INSTALL_CONFIGURATIONS = "" (was not used)
|
||||
# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
|
||||
#
|
||||
# You can the continue and process these variables.
|
||||
#
|
||||
# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
|
||||
# another recognized keyword follows, this is interpreted as the beginning of
|
||||
# the new option.
|
||||
# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
|
||||
# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
|
||||
# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
|
||||
# nor the names of their contributors may be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
|
||||
|
||||
if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
|
||||
return()
|
||||
endif()
|
||||
set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
|
||||
|
||||
|
||||
function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
|
||||
# first set all result variables to empty/FALSE
|
||||
foreach(arg_name ${_singleArgNames} ${_multiArgNames})
|
||||
set(${prefix}_${arg_name})
|
||||
endforeach(arg_name)
|
||||
|
||||
foreach(option ${_optionNames})
|
||||
set(${prefix}_${option} FALSE)
|
||||
endforeach(option)
|
||||
|
||||
set(${prefix}_UNPARSED_ARGUMENTS)
|
||||
|
||||
set(insideValues FALSE)
|
||||
set(currentArgName)
|
||||
|
||||
# now iterate over all arguments and fill the result variables
|
||||
foreach(currentArg ${ARGN})
|
||||
list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
|
||||
list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
|
||||
list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
|
||||
|
||||
if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
|
||||
if(insideValues)
|
||||
if("${insideValues}" STREQUAL "SINGLE")
|
||||
set(${prefix}_${currentArgName} ${currentArg})
|
||||
set(insideValues FALSE)
|
||||
elseif("${insideValues}" STREQUAL "MULTI")
|
||||
list(APPEND ${prefix}_${currentArgName} ${currentArg})
|
||||
endif()
|
||||
else(insideValues)
|
||||
list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
|
||||
endif(insideValues)
|
||||
else()
|
||||
if(NOT ${optionIndex} EQUAL -1)
|
||||
set(${prefix}_${currentArg} TRUE)
|
||||
set(insideValues FALSE)
|
||||
elseif(NOT ${singleArgIndex} EQUAL -1)
|
||||
set(currentArgName ${currentArg})
|
||||
set(${prefix}_${currentArgName})
|
||||
set(insideValues "SINGLE")
|
||||
elseif(NOT ${multiArgIndex} EQUAL -1)
|
||||
set(currentArgName ${currentArg})
|
||||
set(${prefix}_${currentArgName})
|
||||
set(insideValues "MULTI")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach(currentArg)
|
||||
|
||||
# propagate the result variables to the caller:
|
||||
foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
|
||||
set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
|
||||
endforeach(arg_name)
|
||||
set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
|
||||
|
||||
endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)
|
|
@ -1,63 +0,0 @@
|
|||
|
||||
#=============================================================================
|
||||
# Copyright 2002-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# This module is shared by multiple languages; use include blocker.
|
||||
if(__COMPILER_GNU)
|
||||
return()
|
||||
endif()
|
||||
set(__COMPILER_GNU 1)
|
||||
|
||||
macro(__compiler_gnu lang)
|
||||
# Feature flags.
|
||||
set(CMAKE_${lang}_VERBOSE_FLAG "-v")
|
||||
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
|
||||
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4)
|
||||
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
|
||||
endif()
|
||||
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.2)
|
||||
set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
|
||||
endif()
|
||||
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
|
||||
set(CMAKE_${lang}_COMPILE_OPTIONS_SYSROOT "--sysroot=")
|
||||
|
||||
# Older versions of gcc (< 4.5) contain a bug causing them to report a missing
|
||||
# header file as a warning if depfiles are enabled, causing check_header_file
|
||||
# tests to always succeed. Work around this by disabling dependency tracking
|
||||
# in try_compile mode.
|
||||
get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE)
|
||||
if(NOT _IN_TC OR CMAKE_FORCE_DEPFILES)
|
||||
# distcc does not transform -o to -MT when invoking the preprocessor
|
||||
# internally, as it ought to. Work around this bug by setting -MT here
|
||||
# even though it isn't strictly necessary.
|
||||
set(CMAKE_DEPFILE_FLAGS_${lang} "-MMD -MT <OBJECT> -MF <DEPFILE>")
|
||||
endif()
|
||||
|
||||
# Initial configuration flags.
|
||||
set(CMAKE_${lang}_FLAGS_INIT "")
|
||||
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "")
|
||||
set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
|
||||
set(CMAKE_${lang}_FLAGS_RELEASE_INIT "")
|
||||
set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -DNDEBUG")
|
||||
if(CMAKE_VERSION VERSION_LESS 3.4.0)
|
||||
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
|
||||
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
|
||||
else()
|
||||
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
|
||||
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
|
||||
endif()
|
||||
if(NOT APPLE)
|
||||
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
|
||||
endif()
|
||||
endmacro()
|
|
@ -1,261 +0,0 @@
|
|||
|
||||
#=============================================================================
|
||||
# Copyright 2001-2012 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# This module is shared by multiple languages; use include blocker.
|
||||
if(__WINDOWS_MSVC)
|
||||
return()
|
||||
endif()
|
||||
set(__WINDOWS_MSVC 1)
|
||||
|
||||
set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:")
|
||||
set(CMAKE_LINK_LIBRARY_FLAG "")
|
||||
set(MSVC 1)
|
||||
|
||||
# hack: if a new cmake (which uses CMAKE_LINKER) runs on an old build tree
|
||||
# (where link was hardcoded) and where CMAKE_LINKER isn't in the cache
|
||||
# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun)
|
||||
# hardcode CMAKE_LINKER here to link, so it behaves as it did before, Alex
|
||||
if(NOT DEFINED CMAKE_LINKER)
|
||||
set(CMAKE_LINKER link)
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERBOSE_MAKEFILE)
|
||||
set(CMAKE_CL_NOLOGO)
|
||||
else()
|
||||
set(CMAKE_CL_NOLOGO "/nologo")
|
||||
endif()
|
||||
|
||||
set(WIN32 1)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
|
||||
set(CMAKE_CREATE_WIN32_EXE "/subsystem:windowsce /entry:WinMainCRTStartup")
|
||||
set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /entry:mainACRTStartup")
|
||||
set(WINCE 1)
|
||||
else()
|
||||
set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows")
|
||||
set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console")
|
||||
endif()
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
|
||||
set (CMAKE_NO_BUILD_TYPE 1)
|
||||
endif()
|
||||
if(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
set (CMAKE_NO_BUILD_TYPE 1)
|
||||
set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING
|
||||
"Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.")
|
||||
mark_as_advanced(CMAKE_CONFIGURATION_TYPES)
|
||||
endif()
|
||||
|
||||
# make sure to enable languages after setting configuration types
|
||||
enable_language(RC)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.4.0)
|
||||
set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
|
||||
else()
|
||||
set(CMAKE_COMPILE_RESOURCE "rc <INCLUDES> <FLAGS> /fo<OBJECT> <SOURCE>")
|
||||
endif()
|
||||
|
||||
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
|
||||
set(MSVC_IDE 1)
|
||||
else()
|
||||
set(MSVC_IDE 0)
|
||||
endif()
|
||||
|
||||
if(NOT MSVC_VERSION)
|
||||
if(CMAKE_C_COMPILER_VERSION)
|
||||
set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
|
||||
else()
|
||||
set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
|
||||
endif()
|
||||
if("${_compiler_version}" MATCHES "^([0-9]+)\\.([0-9]+)")
|
||||
math(EXPR MSVC_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}")
|
||||
else()
|
||||
message(FATAL_ERROR "MSVC compiler version not detected properly: ${_compiler_version}")
|
||||
endif()
|
||||
|
||||
set(MSVC10)
|
||||
set(MSVC11)
|
||||
set(MSVC12)
|
||||
set(MSVC60)
|
||||
set(MSVC70)
|
||||
set(MSVC71)
|
||||
set(MSVC80)
|
||||
set(MSVC90)
|
||||
set(CMAKE_COMPILER_2005)
|
||||
set(CMAKE_COMPILER_SUPPORTS_PDBTYPE)
|
||||
if(NOT "${_compiler_version}" VERSION_LESS 18)
|
||||
set(MSVC12 1)
|
||||
elseif(NOT "${_compiler_version}" VERSION_LESS 17)
|
||||
set(MSVC11 1)
|
||||
elseif(NOT "${_compiler_version}" VERSION_LESS 16)
|
||||
set(MSVC10 1)
|
||||
elseif(NOT "${_compiler_version}" VERSION_LESS 15)
|
||||
set(MSVC90 1)
|
||||
elseif(NOT "${_compiler_version}" VERSION_LESS 14)
|
||||
set(MSVC80 1)
|
||||
set(CMAKE_COMPILER_2005 1)
|
||||
elseif(NOT "${_compiler_version}" VERSION_LESS 13.10)
|
||||
set(MSVC71 1)
|
||||
elseif(NOT "${_compiler_version}" VERSION_LESS 13)
|
||||
set(MSVC70 1)
|
||||
else()
|
||||
set(MSVC60 1)
|
||||
set(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC_C_ARCHITECTURE_ID MATCHES 64 OR MSVC_CXX_ARCHITECTURE_ID MATCHES 64)
|
||||
set(CMAKE_CL_64 1)
|
||||
else()
|
||||
set(CMAKE_CL_64 0)
|
||||
endif()
|
||||
if(CMAKE_FORCE_WIN64 OR CMAKE_FORCE_IA64)
|
||||
set(CMAKE_CL_64 1)
|
||||
endif()
|
||||
|
||||
if(MSVC_VERSION GREATER 1599)
|
||||
set(MSVC_INCREMENTAL_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
# default to Debug builds
|
||||
set(CMAKE_BUILD_TYPE_INIT Debug)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
|
||||
string(TOUPPER "${MSVC_C_ARCHITECTURE_ID}" _MSVC_C_ARCHITECTURE_ID_UPPER)
|
||||
string(TOUPPER "${MSVC_CXX_ARCHITECTURE_ID}" _MSVC_CXX_ARCHITECTURE_ID_UPPER)
|
||||
|
||||
if("${CMAKE_SYSTEM_VERSION}" MATCHES "^([0-9]+)\\.([0-9]+)")
|
||||
math(EXPR _CE_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}")
|
||||
elseif("${CMAKE_SYSTEM_VERSION}" STREQUAL "")
|
||||
set(_CE_VERSION "500")
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid Windows CE version: ${CMAKE_SYSTEM_VERSION}")
|
||||
endif()
|
||||
|
||||
set(_PLATFORM_DEFINES "/D_WIN32_WCE=0x${_CE_VERSION} /DUNDER_CE")
|
||||
set(_PLATFORM_DEFINES_C " /D${MSVC_C_ARCHITECTURE_ID} /D_${_MSVC_C_ARCHITECTURE_ID_UPPER}_")
|
||||
set(_PLATFORM_DEFINES_CXX " /D${MSVC_CXX_ARCHITECTURE_ID} /D_${_MSVC_CXX_ARCHITECTURE_ID_UPPER}_")
|
||||
|
||||
set(_RTC1 "")
|
||||
set(_FLAGS_CXX " /GR /EHsc")
|
||||
set(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib")
|
||||
else()
|
||||
set(_PLATFORM_DEFINES "/DWIN32")
|
||||
|
||||
if(MSVC_VERSION GREATER 1310)
|
||||
set(_RTC1 "/RTC1")
|
||||
set(_FLAGS_CXX " /GR /EHsc")
|
||||
set(CMAKE_C_STANDARD_LIBRARIES_INIT "")
|
||||
else()
|
||||
set(_RTC1 "/GZ")
|
||||
set(_FLAGS_CXX " /GR /GX")
|
||||
set(CMAKE_C_STANDARD_LIBRARIES_INIT "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
|
||||
|
||||
# executable linker flags
|
||||
set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
|
||||
# set the machine type
|
||||
set(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID})
|
||||
if(NOT _MACHINE_ARCH_FLAG)
|
||||
set(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID})
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
|
||||
if(_MACHINE_ARCH_FLAG MATCHES "ARM")
|
||||
set(_MACHINE_ARCH_FLAG "THUMB")
|
||||
elseif(_MACHINE_ARCH_FLAG MATCHES "SH")
|
||||
set(_MACHINE_ARCH_FLAG "SH4")
|
||||
endif()
|
||||
endif()
|
||||
set (CMAKE_EXE_LINKER_FLAGS_INIT
|
||||
"${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${_MACHINE_ARCH_FLAG} /MANIFEST:NO")
|
||||
|
||||
# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype
|
||||
# on versions that support it
|
||||
set( MSVC_INCREMENTAL_YES_FLAG "")
|
||||
if(NOT MSVC_INCREMENTAL_DEFAULT)
|
||||
set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES")
|
||||
else()
|
||||
set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" )
|
||||
endif()
|
||||
|
||||
if (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
|
||||
if(NOT USE_CLANG_CL)
|
||||
set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept")
|
||||
set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}")
|
||||
else()
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug")
|
||||
endif()
|
||||
else ()
|
||||
set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug")
|
||||
set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug ${MSVC_INCREMENTAL_YES_FLAG}")
|
||||
endif ()
|
||||
# for release and minsize release default to no incremental linking
|
||||
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT "/INCREMENTAL:NO")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT "/INCREMENTAL:NO")
|
||||
|
||||
# copy the EXE_LINKER flags to SHARED and MODULE linker flags
|
||||
# shared linker flags
|
||||
set (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
|
||||
set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
|
||||
set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
|
||||
set (CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})
|
||||
set (CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
|
||||
# module linker flags
|
||||
set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT})
|
||||
set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT})
|
||||
set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})
|
||||
set (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})
|
||||
set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT})
|
||||
|
||||
macro(__windows_compiler_msvc lang)
|
||||
if(NOT "${CMAKE_${lang}_COMPILER_VERSION}" VERSION_LESS 14)
|
||||
# for 2005 make sure the manifest is put in the dll with mt
|
||||
set(_CMAKE_VS_LINK_DLL "<CMAKE_COMMAND> -E vs_link_dll ")
|
||||
set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe ")
|
||||
endif()
|
||||
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY "<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
|
||||
|
||||
set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY})
|
||||
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS 3.4.0)
|
||||
set(CMAKE_${lang}_COMPILE_OBJECT
|
||||
"<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<OBJECT_DIR>/ -c <SOURCE>${CMAKE_END_TEMP_FILE}")
|
||||
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
|
||||
"<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}")
|
||||
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE
|
||||
"<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <FLAGS> <DEFINES> /FoNUL /FAs /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}")
|
||||
else()
|
||||
set(CMAKE_${lang}_COMPILE_OBJECT
|
||||
"<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <INCLUDES> <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<OBJECT_DIR>/ -c <SOURCE>${CMAKE_END_TEMP_FILE}")
|
||||
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
|
||||
"<CMAKE_${lang}_COMPILER> > <PREPROCESSED_SOURCE> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <INCLUDES> <FLAGS> <DEFINES> -E <SOURCE>${CMAKE_END_TEMP_FILE}")
|
||||
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE
|
||||
"<CMAKE_${lang}_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} <INCLUDES> <FLAGS> <DEFINES> /FoNUL /FAs /Fa<ASSEMBLY_SOURCE> /c <SOURCE>${CMAKE_END_TEMP_FILE}")
|
||||
endif()
|
||||
|
||||
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
|
||||
set(CMAKE_${lang}_LINK_EXECUTABLE
|
||||
"${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
|
||||
|
||||
set(CMAKE_${lang}_FLAGS_INIT "")
|
||||
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "")
|
||||
set(CMAKE_${lang}_FLAGS_RELEASE_INIT "")
|
||||
set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
|
||||
set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
|
||||
endmacro()
|
|
@ -1,36 +0,0 @@
|
|||
SET(WIN32 1)
|
||||
|
||||
SET(CMAKE_STATIC_LIBRARY_PREFIX "")
|
||||
SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
|
||||
SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib
|
||||
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so
|
||||
SET(CMAKE_IMPORT_LIBRARY_PREFIX "")
|
||||
SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib")
|
||||
SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe
|
||||
SET(CMAKE_LINK_LIBRARY_SUFFIX ".lib")
|
||||
SET(CMAKE_DL_LIBS "")
|
||||
|
||||
SET(CMAKE_FIND_LIBRARY_PREFIXES "")
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
|
||||
|
||||
# for borland make long command lines are redirected to a file
|
||||
# with the following syntax, see Windows-bcc32.cmake for use
|
||||
IF(CMAKE_GENERATOR MATCHES "Borland")
|
||||
SET(CMAKE_START_TEMP_FILE "@&&|\n")
|
||||
SET(CMAKE_END_TEMP_FILE "\n|")
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Borland")
|
||||
|
||||
# for nmake make long command lines are redirected to a file
|
||||
# with the following syntax, see Windows-bcc32.cmake for use
|
||||
IF(CMAKE_GENERATOR MATCHES "NMake")
|
||||
# SET(CMAKE_START_TEMP_FILE "@<<\n")
|
||||
# SET(CMAKE_END_TEMP_FILE "\n<<")
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "NMake")
|
||||
|
||||
INCLUDE(Platform/WindowsPaths)
|
||||
|
||||
# uncomment these out to debug nmake and borland makefiles
|
||||
#SET(CMAKE_START_TEMP_FILE "")
|
||||
#SET(CMAKE_END_TEMP_FILE "")
|
||||
#SET(CMAKE_VERBOSE_MAKEFILE 1)
|
||||
|
|
@ -139,6 +139,12 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO /INCREMENTAL:
|
|||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO /INCREMENTAL:NO /SAFESEH:NO /NODEFAULTLIB /RELEASE /IGNORE:4104 ${_hotpatch_link_flag}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /MANIFEST:NO /INCREMENTAL:NO /SAFESEH:NO /NODEFAULTLIB /RELEASE ${_hotpatch_link_flag}")
|
||||
|
||||
# HACK: Remove the /implib argument, implibs are generated separately
|
||||
string(REPLACE "/implib:<TARGET_IMPLIB>" "" CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE}")
|
||||
string(REPLACE "/implib:<TARGET_IMPLIB>" "" CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE}")
|
||||
string(REPLACE "/implib:<TARGET_IMPLIB>" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY}")
|
||||
string(REPLACE "/implib:<TARGET_IMPLIB>" "" CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
|
||||
|
||||
if(CMAKE_DISABLE_NINJA_DEPSLOG)
|
||||
set(cl_includes_flag "")
|
||||
else()
|
||||
|
|
|
@ -66,5 +66,7 @@ set(CMAKE_CXX_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C++ Libraries")
|
|||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import")
|
||||
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_LIST_DIR}/overrides-gcc.cmake")
|
||||
|
||||
# Get GCC version
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
|
||||
|
|
|
@ -55,3 +55,5 @@ set(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "")
|
|||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
|
||||
add_definitions(-D__i386__)
|
||||
endif()
|
||||
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_LIST_DIR}/overrides-msvc.cmake")
|
||||
|
|
Loading…
Reference in a new issue