cmake: set -O2 optimization level only if CMAKE_BUILD_TYPE is not specified

This commit is contained in:
2025-09-25 13:44:10 +03:00
committed by Egor Mayorov
parent 864ef699b7
commit 50b4965354

View File

@@ -491,7 +491,7 @@ source_group (Predictor\\Library FILES ${LIBPREDICTOR})
source_group (Parser FILES ${PARSER}) source_group (Parser FILES ${PARSER})
source_group (PPPA\\PPPA FILES ${PPPA}) source_group (PPPA\\PPPA FILES ${PPPA})
source_group (PPPA\\ZLib FILES ${ZLIB}) source_group (PPPA\\ZLib FILES ${ZLIB})
if (MSVC_IDE) if (MSVC_IDE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /Zc:__cplusplus") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /Zc:__cplusplus")
else() else()
@@ -500,7 +500,9 @@ else()
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif() endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
endif()
endif() endif()
add_subdirectory(projects/Fdvm) add_subdirectory(projects/Fdvm)