CMakeLists.txt 1.0 KB

1234567891011121314151617181920212223242526
  1. cmake_minimum_required (VERSION 2.6)
  2. project(Assembler)
  3. set(SRCS)
  4. # if no file has been set as source and we are on linux with an x86 processor try to use the gas/as assembler
  5. # main-linux-x86-gas.s seems to work for Linux and FreeBSD
  6. if(NOT SRCS AND CMAKE_SYSTEM_PROCESSOR MATCHES "[ix].?86$")
  7. if(CMAKE_SYSTEM MATCHES Linux OR CMAKE_SYSTEM MATCHES FreeBSD)
  8. message(STATUS "Trying to enable ASM-ATT for Linux or FreeBSD on x86")
  9. enable_language(ASM-ATT OPTIONAL)
  10. if(CMAKE_ASM-ATT_COMPILER_WORKS)
  11. message(STATUS "Trying to enable ASM-ATT for Linux/x86 - succeeded")
  12. # this assembler file was created using gcc -S main.c
  13. set(SRCS main-linux-x86-gas.s)
  14. endif(CMAKE_ASM-ATT_COMPILER_WORKS)
  15. endif(CMAKE_SYSTEM MATCHES Linux OR CMAKE_SYSTEM MATCHES FreeBSD)
  16. endif(NOT SRCS AND CMAKE_SYSTEM_PROCESSOR MATCHES "[ix].?86$")
  17. if(NOT SRCS)
  18. message(STATUS "No assembler enabled, using C")
  19. set(SRCS main.c)
  20. endif(NOT SRCS)
  21. add_executable(HelloAsm ${SRCS})
  22. set_target_properties(HelloAsm PROPERTIES LINKER_LANGUAGE C)