summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2012-08-13 17:47:32 (GMT)
committerBrad King <brad.king@kitware.com>2012-08-13 18:19:16 (GMT)
commit77543bde41b0e52c3959016698b529835945d62d (patch)
treeff63e5fbec326c4a5d821e7496c6d2cb52f75b92 /Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
parent7bbaa4283de26864b2e55e819db0884771585467 (diff)
downloadCMake-77543bde41b0e52c3959016698b529835945d62d.zip
CMake-77543bde41b0e52c3959016698b529835945d62d.tar.gz
CMake-77543bde41b0e52c3959016698b529835945d62d.tar.bz2
Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case. Run the following shell code: cmake --help-command-list | grep -v "cmake version" | while read c; do echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | xargs -0 sed -i -f convert.sed && rm convert.sed
Diffstat (limited to 'Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake')
-rw-r--r--Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake112
1 files changed, 56 insertions, 56 deletions
diff --git a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
index 455f95f..0fe2abb 100644
--- a/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
+++ b/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake
@@ -18,39 +18,39 @@
# 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}")
- ELSE ()
- SET(_compilerExecutable "${CMAKE_C_COMPILER}")
- SET(_arg1 "${CMAKE_C_COMPILER_ARG1}")
- ENDIF ()
- EXECUTE_PROCESS(COMMAND ${_compilerExecutable} ${_arg1} -v -E -x ${_lang} -dD dummy
+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}")
+ else ()
+ set(_compilerExecutable "${CMAKE_C_COMPILER}")
+ set(_arg1 "${CMAKE_C_COMPILER_ARG1}")
+ endif ()
+ execute_process(COMMAND ${_compilerExecutable} ${_arg1} -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")
+ 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" )
+ 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})
- STRING(STRIP "${nextLine}" _includePath)
- LIST(APPEND ${_resultIncludeDirs} "${_includePath}")
- ENDFOREACH(nextLine)
+ string(REGEX MATCHALL "[^\n]+\n" _includeLines "${CMAKE_MATCH_1}")
+ foreach(nextLine ${_includeLines})
+ string(STRIP "${nextLine}" _includePath)
+ list(APPEND ${_resultIncludeDirs} "${_includePath}")
+ endforeach(nextLine)
- ENDIF()
+ endif()
# now find the builtin macros:
- STRING(REGEX MATCHALL "#define[^\n]+\n" _defineLines "${_gccStdout}")
+ 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__))
@@ -59,51 +59,51 @@ MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines
# #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}-")
+ 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)
- LIST(APPEND ${_resultDefines} "${_value}")
- ELSE()
- LIST(APPEND ${_resultDefines} " ")
- ENDIF()
- ENDFOREACH(nextLine)
+ list(APPEND ${_resultDefines} "${_name}")
+ if(_value)
+ list(APPEND ${_resultDefines} "${_value}")
+ else()
+ list(APPEND ${_resultDefines} " ")
+ endif()
+ endforeach(nextLine)
-ENDMACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang)
+endmacro(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang)
# 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(_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)
+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)
+if (NOT CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS)
+ if ("${CMAKE_C_COMPILER_ID}" MATCHES GNU OR "${CMAKE_C_COMPILER_ID}" MATCHES Intel)
_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")
- ENDIF ()
-ENDIF ()
+ 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")
+ 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)
+if (NOT CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS)
+ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Intel)
_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")
- ENDIF ()
-ENDIF ()
+ 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")
+ 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})
+set(ENV{LC_ALL} ${_orig_lc_all})
+set(ENV{LC_MESSAGES} ${_orig_lc_messages})
+set(ENV{LANG} ${_orig_lang})