The Assembler test now tests ASM for GNU, Intel, HP, XL and SunPro

Alex
This commit is contained in:
Alex Neundorf 2011-02-12 17:21:58 +01:00
parent 66614a868d
commit cf8809203a
1 changed files with 19 additions and 16 deletions

View File

@ -3,24 +3,27 @@ project(Assembler)
set(SRCS) 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 # (at least) the following toolchains xan process assembler files directly
# main-linux-x86-gas.s seems to work for Linux and FreeBSD # and also generate assembler files from C:
if(NOT SRCS AND CMAKE_SYSTEM_PROCESSOR MATCHES "[ix].?86$") if(CMAKE_C_COMPILER_ID STREQUAL "GNU"
if(CMAKE_SYSTEM MATCHES Linux OR CMAKE_SYSTEM MATCHES FreeBSD) OR CMAKE_C_COMPILER_ID STREQUAL "HP"
message(STATUS "Trying to enable ASM-ATT for Linux or FreeBSD on x86") OR CMAKE_C_COMPILER_ID STREQUAL "Intel"
enable_language(ASM-ATT OPTIONAL) OR CMAKE_C_COMPILER_ID STREQUAL "SunPro"
if(CMAKE_ASM-ATT_COMPILER_WORKS) OR CMAKE_C_COMPILER_ID STREQUAL "XL")
message(STATUS "Trying to enable ASM-ATT for Linux/x86 - succeeded") execute_process(COMMAND ${CMAKE_C_COMPILER} -S "${CMAKE_CURRENT_SOURCE_DIR}/main.c" -o "${CMAKE_CURRENT_BINARY_DIR}/main.s")
# this assembler file was created using gcc -S main.c set(SRCS "${CMAKE_CURRENT_BINARY_DIR}/main.s")
set(SRCS main-linux-x86-gas.s) endif(CMAKE_C_COMPILER_ID STREQUAL "GNU"
endif(CMAKE_ASM-ATT_COMPILER_WORKS) OR CMAKE_C_COMPILER_ID STREQUAL "HP"
endif(CMAKE_SYSTEM MATCHES Linux OR CMAKE_SYSTEM MATCHES FreeBSD) OR CMAKE_C_COMPILER_ID STREQUAL "Intel"
endif(NOT SRCS AND CMAKE_SYSTEM_PROCESSOR MATCHES "[ix].?86$") 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") message(STATUS "No assembler enabled, using C")
set(SRCS main.c) set(SRCS main.c)
endif(NOT SRCS) endif(SRCS)
add_executable(HelloAsm ${SRCS}) add_executable(HelloAsm ${SRCS})
set_target_properties(HelloAsm PROPERTIES LINKER_LANGUAGE C)