Introduce "generator expressions" to add_test()
[cmake.git] / Modules / CMakeForceCompiler.cmake
blobc473011904ff8fae9164b95c53a8ff452f8d9820
1 # This module defines macros intended for use by cross-compiling
2 # toolchain files when CMake is not able to automatically detect the
3 # compiler identification.
5 # Macro CMAKE_FORCE_C_COMPILER has the following signature:
6 #   CMAKE_FORCE_C_COMPILER(<compiler> <compiler-id>)
7 # It sets CMAKE_C_COMPILER to the given compiler and the cmake
8 # internal variable CMAKE_C_COMPILER_ID to the given compiler-id.
9 # It also bypasses the check for working compiler and basic compiler
10 # information tests.
12 # Macro CMAKE_FORCE_CXX_COMPILER has the following signature:
13 #   CMAKE_FORCE_CXX_COMPILER(<compiler> <compiler-id>)
14 # It sets CMAKE_CXX_COMPILER to the given compiler and the cmake
15 # internal variable CMAKE_CXX_COMPILER_ID to the given compiler-id.
16 # It also bypasses the check for working compiler and basic compiler
17 # information tests.
19 # So a simple toolchain file could look like this:
20 #   INCLUDE (CMakeForceCompiler)
21 #   SET(CMAKE_SYSTEM_NAME Generic)
22 #   CMAKE_FORCE_C_COMPILER   (chc12 MetrowerksHicross)
23 #   CMAKE_FORCE_CXX_COMPILER (chc12 MetrowerksHicross)
25 MACRO(CMAKE_FORCE_C_COMPILER compiler id)
26   SET(CMAKE_C_COMPILER "${compiler}")
27   SET(CMAKE_C_COMPILER_ID_RUN TRUE)
28   SET(CMAKE_C_COMPILER_ID ${id})
29   SET(CMAKE_C_COMPILER_WORKS TRUE)
30   SET(CMAKE_C_COMPILER_FORCED TRUE)
32   # Set old compiler id variables.
33   IF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
34     SET(CMAKE_COMPILER_IS_GNUCC 1)
35   ENDIF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
36 ENDMACRO(CMAKE_FORCE_C_COMPILER)
38 MACRO(CMAKE_FORCE_CXX_COMPILER compiler id)
39   SET(CMAKE_CXX_COMPILER "${compiler}")
40   SET(CMAKE_CXX_COMPILER_ID_RUN TRUE)
41   SET(CMAKE_CXX_COMPILER_ID ${id})
42   SET(CMAKE_CXX_COMPILER_WORKS TRUE)
43   SET(CMAKE_CXX_COMPILER_FORCED TRUE)
45   # Set old compiler id variables.
46   IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
47     SET(CMAKE_COMPILER_IS_GNUCXX 1)
48   ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
49 ENDMACRO(CMAKE_FORCE_CXX_COMPILER)