~ubuntu-branches/ubuntu/trusty/cmake3/trusty-updates

« back to all changes in this revision

Viewing changes to Tests/Assembler/CMakeLists.txt

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2017-02-23 17:55:24 UTC
  • Revision ID: package-import@ubuntu.com-20170223175524-5nh7s4pu97fsa0t7
Tags: upstream-3.5.1
ImportĀ upstreamĀ versionĀ 3.5.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
cmake_minimum_required (VERSION 2.6)
 
2
project(Assembler C)
 
3
message("CTEST_FULL_OUTPUT ")
 
4
set(CMAKE_VERBOSE_MAKEFILE 1)
 
5
 
 
6
set(SRCS)
 
7
 
 
8
# (at least) the following toolchains can process assembler files directly
 
9
# and also generate assembler files from C:
 
10
if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode" AND
 
11
    NOT CMAKE_OSX_ARCHITECTURES)
 
12
  if((CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|HP|SunPro|XL)$") OR (CMAKE_C_COMPILER_ID STREQUAL "Intel"  AND  UNIX))
 
13
    set(C_FLAGS "${CMAKE_C_FLAGS}")
 
14
    separate_arguments(C_FLAGS)
 
15
    if(CMAKE_OSX_SYSROOT AND CMAKE_C_SYSROOT_FLAG AND NOT ";${C_FLAGS};" MATCHES ";${CMAKE_C_SYSROOT_FLAG};")
 
16
      list(APPEND C_FLAGS ${CMAKE_C_SYSROOT_FLAG} ${CMAKE_OSX_SYSROOT})
 
17
    endif()
 
18
    # Clang on OS X, and perhaps other compilers, do not support -g
 
19
    # for both generating and assembling, so drop it from generating.
 
20
    list(REMOVE_ITEM C_FLAGS -g)
 
21
    set(SRCS main.s)
 
22
    add_custom_command(
 
23
      OUTPUT main.s
 
24
      COMMAND ${CMAKE_C_COMPILER} ${C_FLAGS} -S ${CMAKE_CURRENT_SOURCE_DIR}/main.c -o main.s
 
25
      DEPENDS main.c
 
26
      VERBATIM
 
27
      )
 
28
  endif()
 
29
endif()
 
30
 
 
31
 
 
32
if(SRCS)
 
33
  set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS}")
 
34
  enable_language(ASM OPTIONAL)
 
35
else()
 
36
  message(STATUS "No assembler enabled, using C")
 
37
  set(SRCS main.c)
 
38
endif()
 
39
 
 
40
add_executable(HelloAsm ${SRCS})