Merge pull request #1 from pedronavf/customizable-cache-file
Customizable cache file and minor changes
This commit is contained in:
@@ -29,5 +29,5 @@ include(${CMAKE_ROOT}/Modules/CheckCCompilerFlag.cmake)
|
|||||||
|
|
||||||
macro(check_c_compiler_flag flag variable)
|
macro(check_c_compiler_flag flag variable)
|
||||||
_check_c_compiler_flag("${flag}" ${variable})
|
_check_c_compiler_flag("${flag}" ${variable})
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Test ${variable}\")\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Test ${variable}\")\n")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|||||||
@@ -33,5 +33,5 @@ macro(check_c_source_compiles source variable)
|
|||||||
else()
|
else()
|
||||||
_check_c_source_compiles("${source}" ${variable} "${ARGN}")
|
_check_c_source_compiles("${source}" ${variable} "${ARGN}")
|
||||||
endif()
|
endif()
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Test ${variable}\")\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Test ${variable}\")\n")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ include(${CMAKE_ROOT}/Modules/CheckCXXCompilerFlag.cmake)
|
|||||||
|
|
||||||
macro(check_cxx_compiler_flag flag variable)
|
macro(check_cxx_compiler_flag flag variable)
|
||||||
_check_cxx_compiler_flag("${flag}" ${variable})
|
_check_cxx_compiler_flag("${flag}" ${variable})
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Test ${variable}\")\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Test ${variable}\")\n")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|||||||
@@ -33,5 +33,5 @@ macro(check_cxx_source_compiles source variable)
|
|||||||
else()
|
else()
|
||||||
_check_cxx_source_compiles("${source}" ${variable} "${ARGN}")
|
_check_cxx_source_compiles("${source}" ${variable} "${ARGN}")
|
||||||
endif()
|
endif()
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Test ${variable}\")\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Test ${variable}\")\n")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|||||||
33
CMakeChecksCache/CheckCXXSymbolExists.cmake
Normal file
33
CMakeChecksCache/CheckCXXSymbolExists.cmake
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# MIT License
|
||||||
|
|
||||||
|
# Copyright (c) 2017-2018 Cristian Adam
|
||||||
|
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.11)
|
||||||
|
|
||||||
|
include(DumpCMakeVariables)
|
||||||
|
include(${CMAKE_ROOT}/Modules/CheckCXXSymbolExists.cmake)
|
||||||
|
|
||||||
|
macro(check_cxx_symbol_exists symbol header variable)
|
||||||
|
_check_cxx_symbol_exists(${symbol} "${header}" ${variable})
|
||||||
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Have C++ symbol ${symbol}\")\n")
|
||||||
|
endmacro()
|
||||||
@@ -29,5 +29,5 @@ include(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
|
|||||||
|
|
||||||
macro(check_function_exists function variable)
|
macro(check_function_exists function variable)
|
||||||
_check_function_exists(${function} ${variable})
|
_check_function_exists(${function} ${variable})
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Have function ${function}\")\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Have function ${function}\")\n")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ include(${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
|||||||
|
|
||||||
macro(check_include_file header variable)
|
macro(check_include_file header variable)
|
||||||
_check_include_file(${header} ${variable})
|
_check_include_file(${header} ${variable})
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Have include ${header}\")\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Have include ${header}\")\n")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ include(${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake)
|
|||||||
|
|
||||||
macro(check_include_file_cxx header variable)
|
macro(check_include_file_cxx header variable)
|
||||||
_check_include_file_cxx(${header} ${variable})
|
_check_include_file_cxx(${header} ${variable})
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Have include ${header}\")\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Have include ${header}\")\n")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|||||||
@@ -33,5 +33,5 @@ macro(check_include_files headers variable)
|
|||||||
else()
|
else()
|
||||||
_check_include_files("${headers}" ${variable} "${ARGN}")
|
_check_include_files("${headers}" ${variable} "${ARGN}")
|
||||||
endif()
|
endif()
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Have include ${headers}\")\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Have include ${headers}\")\n")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ include(${CMAKE_ROOT}/Modules/CheckLibraryExists.cmake)
|
|||||||
|
|
||||||
macro(check_library_exists library function location variable)
|
macro(check_library_exists library function location variable)
|
||||||
_check_library_exists("${library}" ${function} "${location}" ${variable})
|
_check_library_exists("${library}" ${function} "${location}" ${variable})
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Have library ${library}\")\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Have library ${library}\")\n")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ include(${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
|
|||||||
|
|
||||||
macro(check_symbol_exists symbol header variable)
|
macro(check_symbol_exists symbol header variable)
|
||||||
_check_symbol_exists(${symbol} "${header}" ${variable})
|
_check_symbol_exists(${symbol} "${header}" ${variable})
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Have symbol ${symbol}\")\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(${variable} \"${${variable}}\" CACHE INTERNAL \"Have symbol ${symbol}\")\n")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ include(${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
|
|||||||
|
|
||||||
macro(check_type_size type variable)
|
macro(check_type_size type variable)
|
||||||
_check_type_size(${type} ${variable})
|
_check_type_size(${type} ${variable})
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "set(HAVE_${variable} \"${HAVE_${variable}}\" CACHE INTERNAL \"Result of TRY_COMPILE\")\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(HAVE_${variable} \"${HAVE_${variable}}\" CACHE INTERNAL \"Result of TRY_COMPILE\")\n")
|
||||||
if(HAVE_${variable})
|
if(HAVE_${variable})
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "set(${variable} \"${${variable}}\" CACHE INTERNAL \"CHECK_TYPE_SIZE: sizeof(${type})\")\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(${variable} \"${${variable}}\" CACHE INTERNAL \"CHECK_TYPE_SIZE: sizeof(${type})\")\n")
|
||||||
else()
|
else()
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "set(${variable} \"\" CACHE INTERNAL \"CHECK_TYPE_SIZE: ${type} unknown\")\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(${variable} \"\" CACHE INTERNAL \"CHECK_TYPE_SIZE: ${type} unknown\")\n")
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|||||||
@@ -24,9 +24,11 @@ include_guard(GLOBAL)
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.11)
|
cmake_minimum_required(VERSION 3.11)
|
||||||
|
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "###############################################################\n")
|
set(CMAKE_CHECKS_CACHE_FILE "${CMAKE_BINARY_DIR}/cmake_checks_cache.txt" CACHE FILEPATH "CMake checks cache file")
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "# Dump of all cache variables that started with CMAKE_*\n")
|
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "###############################################################\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "###############################################################\n")
|
||||||
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "# Dump of all cache variables that started with CMAKE_*\n")
|
||||||
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "###############################################################\n")
|
||||||
|
|
||||||
get_cmake_property(_cachedVariableNames CACHE_VARIABLES)
|
get_cmake_property(_cachedVariableNames CACHE_VARIABLES)
|
||||||
list(FILTER _cachedVariableNames INCLUDE REGEX "^CMAKE_.*$")
|
list(FILTER _cachedVariableNames INCLUDE REGEX "^CMAKE_.*$")
|
||||||
@@ -34,12 +36,13 @@ foreach (_cacheVariable ${_cachedVariableNames})
|
|||||||
get_property(_type CACHE "${_cacheVariable}" PROPERTY TYPE)
|
get_property(_type CACHE "${_cacheVariable}" PROPERTY TYPE)
|
||||||
get_property(_advanced CACHE "${_cacheVariable}" PROPERTY ADVANCED)
|
get_property(_advanced CACHE "${_cacheVariable}" PROPERTY ADVANCED)
|
||||||
get_property(_help_string CACHE "${_cacheVariable}" PROPERTY HELPSTRING)
|
get_property(_help_string CACHE "${_cacheVariable}" PROPERTY HELPSTRING)
|
||||||
|
string(REPLACE "\"" "\\\"" ${_cacheVariable} "${${_cacheVariable}}")
|
||||||
if (NOT "${_type}" STREQUAL "UNINITIALIZED" AND NOT "${_type}" STREQUAL "STATIC")
|
if (NOT "${_type}" STREQUAL "UNINITIALIZED" AND NOT "${_type}" STREQUAL "STATIC")
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "set(${_cacheVariable} \"${${_cacheVariable}}\" CACHE ${_type} \"${_help_string}\")\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(${_cacheVariable} \"${${_cacheVariable}}\" CACHE ${_type} \"${_help_string}\")\n")
|
||||||
if (${_advanced})
|
if (${_advanced})
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "mark_as_advanced(${_cacheVariable})\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "mark_as_advanced(${_cacheVariable})\n")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}/cmake_checks_cache.txt "###############################################################\n")
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "###############################################################\n")
|
||||||
|
|||||||
35
CMakeChecksCache/TestBigEndian.cmake
Normal file
35
CMakeChecksCache/TestBigEndian.cmake
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# MIT License
|
||||||
|
|
||||||
|
# Copyright (c) 2017-2018 Cristian Adam
|
||||||
|
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
|
include_guard(GLOBAL)
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.11)
|
||||||
|
|
||||||
|
include(DumpCMakeVariables)
|
||||||
|
include(${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
|
||||||
|
|
||||||
|
#macro(TEST_BIG_ENDIAN VARIABLE)
|
||||||
|
|
||||||
|
macro(test_big_endian variable)
|
||||||
|
_test_big_endian(${variable})
|
||||||
|
file(APPEND ${CMAKE_CHECKS_CACHE_FILE} "set(HAVE_${variable} \"${${variable}}\" CACHE INTERNAL \"Test Big Endian ${variable}\")\n")
|
||||||
|
endmacro()
|
||||||
Reference in New Issue
Block a user