2008-03-25 18:27:18 +03:00
|
|
|
cmake_minimum_required (VERSION 2.6)
|
2011-03-04 17:17:30 +03:00
|
|
|
project(Assembler C)
|
2011-03-04 17:08:18 +03:00
|
|
|
message("CTEST_FULL_OUTPUT ")
|
|
|
|
set(CMAKE_VERBOSE_MAKEFILE 1)
|
2007-07-05 17:05:40 +04:00
|
|
|
|
|
|
|
set(SRCS)
|
|
|
|
|
2011-02-24 22:56:53 +03:00
|
|
|
# (at least) the following toolchains can process assembler files directly
|
2011-02-12 19:21:58 +03:00
|
|
|
# and also generate assembler files from C:
|
2011-03-01 23:19:39 +03:00
|
|
|
if("${CMAKE_GENERATOR}" MATCHES "Makefile")
|
2011-03-04 01:02:12 +03:00
|
|
|
if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX))
|
2011-03-04 16:59:56 +03:00
|
|
|
set(C_FLAGS "${CMAKE_C_FLAGS}")
|
|
|
|
separate_arguments(C_FLAGS)
|
2011-03-04 17:08:18 +03:00
|
|
|
set(SRCS main.s)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT main.s
|
|
|
|
COMMAND ${CMAKE_C_COMPILER} ${C_FLAGS} -S ${CMAKE_CURRENT_SOURCE_DIR}/main.c -o main.s
|
|
|
|
DEPENDS main.c
|
|
|
|
VERBATIM
|
|
|
|
)
|
2011-03-04 01:02:12 +03:00
|
|
|
endif(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX))
|
2011-03-01 23:19:39 +03:00
|
|
|
endif("${CMAKE_GENERATOR}" MATCHES "Makefile")
|
2007-07-05 17:05:40 +04:00
|
|
|
|
2011-02-12 19:21:58 +03:00
|
|
|
|
|
|
|
if(SRCS)
|
2012-06-19 00:19:38 +04:00
|
|
|
set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS}")
|
2011-02-12 19:21:58 +03:00
|
|
|
enable_language(ASM OPTIONAL)
|
|
|
|
else(SRCS)
|
2007-07-05 17:05:40 +04:00
|
|
|
message(STATUS "No assembler enabled, using C")
|
|
|
|
set(SRCS main.c)
|
2011-02-12 19:21:58 +03:00
|
|
|
endif(SRCS)
|
2007-07-05 17:05:40 +04:00
|
|
|
|
|
|
|
add_executable(HelloAsm ${SRCS})
|