summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-06-19 12:51:43 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-06-19 12:51:43 (GMT)
commita53f1af79f5b602751d2a3a68e3eb36deba53c23 (patch)
tree696fd745c2e9408ef74bbda0f6526df98eba1c16 /Modules
parentc780524a967ef8e814ad4fcd4e424cdb8fe58f73 (diff)
parent54676a0e4cf30d9f026a0f6521f7171a75f85803 (diff)
downloadCMake-a53f1af79f5b602751d2a3a68e3eb36deba53c23.zip
CMake-a53f1af79f5b602751d2a3a68e3eb36deba53c23.tar.gz
CMake-a53f1af79f5b602751d2a3a68e3eb36deba53c23.tar.bz2
Merge topic 'ConcurrentFortran-compiler-id'
54676a0e Help: Add notes for topic 'ConcurrentFortran-compiler-id' 7cd539b1 Add support for Concurrent Fortran 77 Compiler 0d204c1c CMakeDetermineCompilerId: Try matching compiler output to detect id 5f0dad75 CMakeDetermineCompilerId: Refactor id build/check loop logic c65a060e CMakeDetermineCompilerId: Optionally try some flags before no flags
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake1
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake1
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake34
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake8
-rw-r--r--Modules/Compiler/CCur-Fortran.cmake1
-rw-r--r--Modules/Platform/Linux-CCur-Fortran.cmake1
6 files changed, 40 insertions, 6 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 937aa8c..40d4ce6 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -80,6 +80,7 @@ else()
# 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"
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 893c454..a673525 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -78,6 +78,7 @@ else()
# 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"
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 403ac08..68f2194 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -34,12 +34,19 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
# 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()
+ foreach(flags ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS_FIRST}
+ ""
+ ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS})
+ CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${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()
@@ -355,6 +362,7 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
# 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
@@ -395,10 +403,24 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
"${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()
#-----------------------------------------------------------------------------
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 3a27127..52ec25a 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -98,6 +98,10 @@ else()
# 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"
@@ -111,6 +115,10 @@ endif()
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")
diff --git a/Modules/Compiler/CCur-Fortran.cmake b/Modules/Compiler/CCur-Fortran.cmake
new file mode 100644
index 0000000..6ec06ae
--- /dev/null
+++ b/Modules/Compiler/CCur-Fortran.cmake
@@ -0,0 +1 @@
+include(Compiler/GNU-Fortran)
diff --git a/Modules/Platform/Linux-CCur-Fortran.cmake b/Modules/Platform/Linux-CCur-Fortran.cmake
new file mode 100644
index 0000000..ceecc2f
--- /dev/null
+++ b/Modules/Platform/Linux-CCur-Fortran.cmake
@@ -0,0 +1 @@
+include(Platform/Linux-GNU-Fortran)