Skip to content

Commit

Permalink
build: Rework setting of compiler flags (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis authored Jan 21, 2023
2 parents 6c4ab32 + 373d694 commit 2d46cca
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,8 @@ if(MSVC)
endif()
string(REGEX REPLACE "/W[1|2|3|4]" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wno-psabi -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized -Wshift-negative-value -pthread -g -Og -fPIC")
else()
if (BUILD_O3)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wno-psabi -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized -Wshift-negative-value -pthread -O3 -fPIC")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wno-psabi -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized -Wshift-negative-value -pthread -Os -fPIC")
endif()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-psabi -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized -Wshift-negative-value -pthread")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og")

if (NOT MINGW)
add_link_options("-rdynamic")
Expand All @@ -204,6 +197,7 @@ foreach (fullmodname ${subdirlist})
PROPERTIES
VERSION ${CMAKE_PROJECT_VERSION}
SOVERSION ${CMAKE_PROJECT_VERSION}
POSITION_INDEPENDENT_CODE true
)
target_include_directories(${modname} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
Expand Down Expand Up @@ -246,7 +240,7 @@ foreach (fullmodname ${subdirlist})
endif()
endforeach()

target_compile_features(dpp PRIVATE cxx_std_17)
target_compile_features(dpp PUBLIC cxx_std_17)
target_compile_features(dpp PRIVATE cxx_constexpr)
target_compile_features(dpp PRIVATE cxx_auto_type)
target_compile_features(dpp PRIVATE cxx_defaulted_functions)
Expand Down

0 comments on commit 2d46cca

Please sign in to comment.