Fix compiler flags for GCC < 9

This commit is contained in:
casey langen 2022-12-04 15:09:53 -08:00
parent e34ad7a08d
commit b1fe7c35d6
2 changed files with 7 additions and 2 deletions

View File

@ -1,8 +1,8 @@
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wno-unused-result -Wno-deprecated-declarations")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -g -frtti -fexceptions")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++17 -DDEBUG -g -frtti -fexceptions")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
# enable for additional memory checking with fsanitize
# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3 -fsanitize=address,undefined")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -frtti -fexceptions -Wno-psabi")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++17 -O2 -frtti -fexceptions -Wno-psabi")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -Wno-psabi")

View File

@ -88,6 +88,11 @@ if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
endif()
endif()
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
message(STATUS "[build] detected old gcc, manually adding -lstdc++fs")
set (musikcube_LINK_LIBS ${musikcube_LINK_LIBS} stdc++fs)
endif()
message(STATUS "[build] musikcube_LINK_LIBS: " ${musikcube_LINK_LIBS})
add_subdirectory(src/musikcore)