Skip to content

Commit

Permalink
Use add_compile_options instead of add_definitions where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
szpajder committed Dec 20, 2021
1 parent 085d62a commit 7a7c7c4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ endif()

CHECK_CXX_COMPILER_FLAG(-pthread CXX_HAS_PTHREAD)
if(CXX_HAS_PTHREAD)
add_definitions(-pthread)
add_compile_options(-pthread)
endif()

CHECK_CXX_COMPILER_FLAG(-ffast-math CXX_HAS_FFAST_MATH)
if(CXX_HAS_FFAST_MATH)
add_definitions(-ffast-math)
add_compile_options(-ffast-math)
endif()

# asprintf on MacOS
Expand Down Expand Up @@ -177,28 +177,28 @@ set(WITH_BCM_VC FALSE)

if(PLATFORM STREQUAL "rpiv1")
set(BCM_VC ON)
add_definitions(-march=armv6zk -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfpu=vfp)
add_compile_options(-march=armv6zk -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfpu=vfp)
enable_language(ASM)
list(APPEND rtl_airband_extra_sources rtl_airband_vfp.s)
elseif(PLATFORM STREQUAL "rpiv2")
set(BCM_VC ON)
add_definitions(-march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard)
add_compile_options(-march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard)
enable_language(ASM)
list(APPEND rtl_airband_extra_sources rtl_airband_neon.s)
elseif(PLATFORM STREQUAL "armv7-generic")
add_definitions(-march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard)
add_compile_options(-march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard)
elseif(PLATFORM STREQUAL "armv8-generic")
add_definitions(-march=armv8-a+crc -mtune=cortex-a53)
add_compile_options(-march=armv8-a+crc -mtune=cortex-a53)
elseif(PLATFORM STREQUAL "native")
CHECK_CXX_COMPILER_FLAG(-march=native CXX_HAS_MARCH_NATIVE)
if(CXX_HAS_MARCH_NATIVE)
add_definitions(-march=native)
add_compile_options(-march=native)
else()
message(FATAL_ERROR "Cannot build with PLATFORM=native: the compiler does not support -march=native option")
endif()
CHECK_CXX_COMPILER_FLAG(-mtune=native CXX_HAS_MTUNE_NATIVE)
if(CXX_HAS_MTUNE_NATIVE)
add_definitions(-mtune=native)
add_compile_options(-mtune=native)
else()
message(FATAL_ERROR "Cannot build with PLATFORM=native: the compiler does not support -mtune=native option")
endif()
Expand Down

0 comments on commit 7a7c7c4

Please sign in to comment.