Merge branch 'cmake_nasm' into 'master'

CMake: Fix nasm Linux builds

When compiling under Linux with CMake and nasm/yasm enabled, the operation would fail during linking with undefined symbols related to the tmap files.
This commit adds support for passing flags to the assembler and passes ```-DLINUX``` in order to compile.

After this change, binaries are successfully compiled with either nasm or yasm on Linux systems.
Tested on Ubuntu.

See merge request !153
This commit is contained in:
Alam Ed Arias 2017-01-12 17:21:05 -05:00
commit e7a1c81355
1 changed files with 7 additions and 0 deletions

View File

@ -390,11 +390,18 @@ if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
endif()
if(${SRB2_CONFIG_USEASM})
#SRB2_ASM_FLAGS can be used to pass flags to either nasm or yasm.
if(${CMAKE_SYSTEM} MATCHES "Linux")
set(SRB2_ASM_FLAGS "-DLINUX ${SRB2_ASM_FLAGS}")
endif()
if(${SRB2_CONFIG_YASM})
set(CMAKE_ASM_YASM_SOURCE_FILE_EXTENSIONS ${CMAKE_ASM_YASM_SOURCE_FILE_EXTENSIONS} nas)
set(CMAKE_ASM_YASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.")
enable_language(ASM_YASM)
else()
set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS ${CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS} nas)
set(CMAKE_ASM_NASM_FLAGS "${SRB2_ASM_FLAGS}" CACHE STRING "Flags used by the assembler during all build types.")
enable_language(ASM_NASM)
endif()
set(SRB2_USEASM ON)