Skip to content

Commit e4e34e1

Browse files
committed
only mute deprecation warnings for GCC
1 parent 6658965 commit e4e34e1

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

CMakeLists.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ cmake_minimum_required(VERSION 3.20)
66
# Set the C++ standard to C++11
77
set(CMAKE_CXX_STANDARD 11)
88
set(CMAKE_CXX_STANDARD_REQUIRED ON)
9+
SET(CMAKE_CXX_EXTENSIONS OFF)
910

1011
# optional cmake command line arguments (e.g, "cmake -D COMPILE_LIB=ON" .)
1112
option(COMPILE_LIB "If ON, will create a dynamic lib file (default: OFF)" OFF)
@@ -42,16 +43,12 @@ if(PYTHON)
4243
pybind11_add_module(libraven MODULE src/py/libraven.cpp)
4344
include_directories("src")
4445
target_compile_features(libraven PUBLIC cxx_std_11)
45-
# Mute deprecated warnings
46-
target_compile_options(libraven PRIVATE -Wno-deprecated)
4746
endif()
4847

4948
# creates a shared library - file extension is OS dependent (Linux: .so, Windows: .dll)
5049
if(COMPILE_LIB)
5150
add_library(ravenbmi SHARED ${SOURCE})
5251
target_compile_definitions(ravenbmi PUBLIC BMI_LIBRARY)
53-
# Mute deprecated warnings
54-
target_compile_options(ravenbmi PRIVATE -Wno-deprecated)
5552
endif()
5653

5754
# creates an executable - file extension is OS dependent (Linux: none, Windows: .exe)
@@ -61,8 +58,13 @@ if(COMPILE_EXE)
6158
${HEADER}
6259
)
6360
set_target_properties(Raven PROPERTIES LINKER_LANGUAGE CXX)
64-
# Mute deprecated warnings
65-
target_compile_options(Raven PRIVATE -Wno-deprecated)
61+
62+
# Remove deprecation warnings for GCC
63+
IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
64+
target_compile_options(Raven PRIVATE "-Wno-deprecated")
65+
message(STATUS "Modified compile flags with '-Wno-deprecated'")
66+
ENDIF()
67+
6668
if(LPSOLVE)
6769
target_link_directories(Raven PRIVATE lib/lp_solve) # where liblpsolve55.so is located
6870
target_link_libraries(Raven lpsolve55)

0 commit comments

Comments
 (0)