Reworked cmake compiler arguments

This commit is contained in:
AlexandreRouma 2021-10-03 01:13:15 +02:00
parent 163e35727c
commit 4564475821
30 changed files with 98 additions and 92 deletions

View File

@ -46,11 +46,11 @@ option(OPT_BUILD_RIGCTL_SERVER "Rigctl backend for controlling SDR++ with softwa
# Compiler arguments for each platform
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
# Core of SDR++

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(airspy_source)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
include_directories("src/")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(airspyhf_source)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
include_directories("src/")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(audio_sink)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
file(GLOB SRC "src/*.cpp")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(bladerf_source)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
include_directories("src/")

View File

@ -1,19 +1,19 @@
cmake_minimum_required(VERSION 3.13)
project(sdrpp_core)
add_subdirectory("libcorrect/")
# Set compiler options
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
add_definitions(-DSDRPP_IS_CORE)
add_subdirectory("libcorrect/")
# Main code
file(GLOB_RECURSE SRC "src/*.cpp" "src/*.c")
@ -96,6 +96,7 @@ else()
endif ()
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# TODO: Replace with add_compile_options?
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
endif ()

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(demo)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
file(GLOB SRC "src/*.cpp")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(discord_integration)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup -fPIC")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fPIC")
add_compile_options(-O3 -std=c++17)
endif ()
add_subdirectory("discord-rpc")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(falcon9_decoder)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
file(GLOB_RECURSE SRC "src/*.cpp" "src/*.c")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(file_source)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
include_directories("src/")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(frequency_manager)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
include_directories("src/" "../radio/src")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(hackrf_source)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
include_directories("src/")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(limesdr_source)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
include_directories("src/")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(m17_decoder)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
file(GLOB_RECURSE SRC "src/*.cpp" "src/*.c")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(meteor_demodulator)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
file(GLOB_RECURSE SRC "src/*.cpp" "src/*.c")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(network_sink)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
file(GLOB SRC "src/*.cpp")

View File

@ -2,9 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(new_portaudio_sink)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
else()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fpermissive")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
add_compile_options(-O3 -std=c++17 -fpermissive)
endif (MSVC)
file(GLOB SRC "src/*.cpp")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(plutosdr_source)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
include_directories("src/")

View File

@ -2,11 +2,14 @@ cmake_minimum_required(VERSION 3.13)
project(audio_sink)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
else()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fpermissive")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
add_compile_options(-O3 -std=c++17 -fpermissive)
endif (MSVC)
file(GLOB SRC "src/*.cpp")
include_directories("src/")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(radio)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
file(GLOB SRC "src/*.cpp")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(recorder)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
file(GLOB SRC "src/*.cpp")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(rigctl_server)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
file(GLOB SRC "src/*.cpp")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(rtl_sdr_source)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
include_directories("src/")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(rtl_tcp_source)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
include_directories("src/")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(scanner)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
file(GLOB SRC "src/*.cpp")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(sddc_source)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
include_directories("src/" "src/libsddc/" "src/libsddc/Core/" "src/libsddc/Core/pffft/" "src/libsddc/libsddc/")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(sdrplay_source)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
include_directories("src/")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(soapy_source)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
file(GLOB SRC "src/*.cpp")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(spyserver_source)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
include_directories("src/")

View File

@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.13)
project(weather_sat_decoder)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
add_compile_options(/O2 /std:c++17 /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
add_compile_options(-O3 -std=c++17)
endif ()
file(GLOB_RECURSE SRC "src/*.cpp" "src/*.c")