summaryrefslogtreecommitdiff
path: root/Tests/Assembler
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-02-12 17:21:58 +0100
committerAlex Neundorf <neundorf@kde.org>2011-02-23 21:30:27 +0100
commitcf8809203ae4e37a529879bd41ae5c7b058a3cf9 (patch)
tree0e9493c47a5ccc28556a3059fcf556d0b78d9c58 /Tests/Assembler
parent66614a868d7f7c3493d75c7047f1c0ca443ce099 (diff)
downloadcmake-cf8809203ae4e37a529879bd41ae5c7b058a3cf9.tar.gz
The Assembler test now tests ASM for GNU, Intel, HP, XL and SunPro
Alex
Diffstat (limited to 'Tests/Assembler')
-rw-r--r--Tests/Assembler/CMakeLists.txt35
1 files changed, 19 insertions, 16 deletions
diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt
index b2937bbb1c..bdde107ed6 100644
--- a/Tests/Assembler/CMakeLists.txt
+++ b/Tests/Assembler/CMakeLists.txt
@@ -3,24 +3,27 @@ project(Assembler)
set(SRCS)
-# if no file has been set as source and we are on linux with an x86 processor try to use the gas/as assembler
-# main-linux-x86-gas.s seems to work for Linux and FreeBSD
-if(NOT SRCS AND CMAKE_SYSTEM_PROCESSOR MATCHES "[ix].?86$")
- if(CMAKE_SYSTEM MATCHES Linux OR CMAKE_SYSTEM MATCHES FreeBSD)
- message(STATUS "Trying to enable ASM-ATT for Linux or FreeBSD on x86")
- enable_language(ASM-ATT OPTIONAL)
- if(CMAKE_ASM-ATT_COMPILER_WORKS)
- message(STATUS "Trying to enable ASM-ATT for Linux/x86 - succeeded")
- # this assembler file was created using gcc -S main.c
- set(SRCS main-linux-x86-gas.s)
- endif(CMAKE_ASM-ATT_COMPILER_WORKS)
- endif(CMAKE_SYSTEM MATCHES Linux OR CMAKE_SYSTEM MATCHES FreeBSD)
-endif(NOT SRCS AND CMAKE_SYSTEM_PROCESSOR MATCHES "[ix].?86$")
+# (at least) the following toolchains xan process assembler files directly
+# and also generate assembler files from C:
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU"
+ OR CMAKE_C_COMPILER_ID STREQUAL "HP"
+ OR CMAKE_C_COMPILER_ID STREQUAL "Intel"
+ OR CMAKE_C_COMPILER_ID STREQUAL "SunPro"
+ OR CMAKE_C_COMPILER_ID STREQUAL "XL")
+ execute_process(COMMAND ${CMAKE_C_COMPILER} -S "${CMAKE_CURRENT_SOURCE_DIR}/main.c" -o "${CMAKE_CURRENT_BINARY_DIR}/main.s")
+ set(SRCS "${CMAKE_CURRENT_BINARY_DIR}/main.s")
+endif(CMAKE_C_COMPILER_ID STREQUAL "GNU"
+ OR CMAKE_C_COMPILER_ID STREQUAL "HP"
+ OR CMAKE_C_COMPILER_ID STREQUAL "Intel"
+ OR CMAKE_C_COMPILER_ID STREQUAL "SunPro"
+ OR CMAKE_C_COMPILER_ID STREQUAL "XL")
-if(NOT SRCS)
+
+if(SRCS)
+ enable_language(ASM OPTIONAL)
+else(SRCS)
message(STATUS "No assembler enabled, using C")
set(SRCS main.c)
-endif(NOT SRCS)
+endif(SRCS)
add_executable(HelloAsm ${SRCS})
-set_target_properties(HelloAsm PROPERTIES LINKER_LANGUAGE C)