Skip to content

Commit 470a5b6

Browse files
acceleratedAlexander Damian
authored andcommitted
Set CMAKE_CXX_FLAGS only when not set
1 parent a17a6f3 commit 470a5b6

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

CMakeLists.txt

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@ set(CPPKAFKA_VERSION_MINOR 2)
77
set(CPPKAFKA_VERSION "${CPPKAFKA_VERSION_MAJOR}.${CPPKAFKA_VERSION_MINOR}")
88
set(RDKAFKA_MIN_VERSION 0x00090400)
99

10-
if(MSVC)
11-
# Don't always use Wall, since VC's /Wall is ridiculously verbose.
12-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
13-
14-
# Disable VC secure checks, since these are not really issues
15-
add_definitions("-D_CRT_SECURE_NO_WARNINGS=1")
16-
add_definitions("-D_SCL_SECURE_NO_WARNINGS=1")
17-
add_definitions("-DNOGDI=1")
18-
add_definitions("-DNOMINMAX=1")
19-
else()
20-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
10+
if (NOT CMAKE_CXX_FLAGS)
11+
# Set default compile flags for the project
12+
if(MSVC)
13+
# Don't always use Wall, since VC's /Wall is ridiculously verbose.
14+
set(CMAKE_CXX_FLAGS "/W3")
15+
16+
# Disable VC secure checks, since these are not really issues
17+
add_definitions("-D_CRT_SECURE_NO_WARNINGS=1")
18+
add_definitions("-D_SCL_SECURE_NO_WARNINGS=1")
19+
add_definitions("-DNOGDI=1")
20+
add_definitions("-DNOMINMAX=1")
21+
else()
22+
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall")
23+
endif()
2124
endif()
2225
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
2326

0 commit comments

Comments
 (0)