[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.25 1.26 CompilerIdVendorTest.cmake.in 1.1 1.2

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Feb 1 09:03:07 EST 2010


Update of /cvsroot/CMake/CMake/Tests/CMakeTests
In directory public:/mounts/ram/cvs-serv21835/Tests/CMakeTests

Modified Files:
	CMakeLists.txt 
Added Files:
	CompilerIdVendorTest.cmake.in 
Log Message:
Add alternate per-vendor compiler id detection

At least one Fortran compiler does not provide a preprocessor symbol to
identify itself.  Instead we try running unknown compilers with version
query flags known for each vendor and look for known output.  Future
commits will add vendor-specific flags/output table entries.


--- NEW FILE: CompilerIdVendorTest.cmake.in ---
# This is not supposed to be included by user code, but we need to
# test it.
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)

set(MY_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/CompilerIdVendor")
file(REMOVE_RECURSE ${MY_BINARY_DIR})
file(MAKE_DIRECTORY ${MY_BINARY_DIR})

set(CMAKE_MyLang_COMPILER ${CMAKE_COMMAND})
set(CMAKE_MyLang_COMPILER_ID_ARG1)
set(CMAKE_MyLang_COMPILER_ID_FLAGS_LIST)
set(CMAKE_MyLang_COMPILER_ID_DIR ${MY_BINARY_DIR})

file(WRITE "${MY_BINARY_DIR}/BogusVendor.cmake" "message(\"This is a BogusVendor compiler\")")
list(APPEND CMAKE_MyLang_COMPILER_ID_VENDORS BogusVendor)
set(CMAKE_MyLang_COMPILER_ID_VENDOR_FLAGS_BogusVendor -P BogusVendor.cmake)
set(CMAKE_MyLang_COMPILER_ID_VENDOR_REGEX_BogusVendor ThisDoesNotMatch_BogusVendor)

file(WRITE "${MY_BINARY_DIR}/MyVendor.cmake" "message(\"This is a MyVendor compiler\")")
list(APPEND CMAKE_MyLang_COMPILER_ID_VENDORS MyVendor)
set(CMAKE_MyLang_COMPILER_ID_VENDOR_FLAGS_MyVendor -P MyVendor.cmake)
set(CMAKE_MyLang_COMPILER_ID_VENDOR_REGEX_MyVendor MyVendor)

set(CMAKE_BINARY_DIR ${MY_BINARY_DIR})
cmake_determine_compiler_id_vendor(MyLang)

if("${CMAKE_MyLang_COMPILER_ID}" STREQUAL "MyVendor")
  message(STATUS "Found MyVendor compiler id!")
else()
  message(FATAL_ERROR "Did not find MyVendor compiler id: [${CMAKE_MyLang_COMPILER_ID}]")
endif()

Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/CMakeTests/CMakeLists.txt,v
retrieving revision 1.25
retrieving revision 1.26
diff -C 2 -d -r1.25 -r1.26
*** CMakeLists.txt	8 Dec 2009 16:44:28 -0000	1.25
--- CMakeLists.txt	1 Feb 2010 14:03:05 -0000	1.26
***************
*** 27,30 ****
--- 27,31 ----
  AddCMakeTest(Math "")
  AddCMakeTest(CMakeMinimumRequired "")
+ AddCMakeTest(CompilerIdVendor "")
  
  if(HAVE_ELF_H)



More information about the Cmake-commits mailing list