diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b326a3..84ee659 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,9 +118,6 @@ include_directories(${YAML_CPP_SOURCE_DIR}/include) ### ### General compilation settings ### -set(yaml_c_flags ${CMAKE_C_FLAGS}) -set(yaml_cxx_flags ${CMAKE_CXX_FLAGS}) - if(BUILD_SHARED_LIBS) set(LABEL_SUFFIX "shared") else() @@ -179,7 +176,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR set(GCC_EXTRA_OPTIONS "${GCC_EXTRA_OPTIONS} ${FLAG_TESTED}") endif() # - set(yaml_cxx_flags "-Wall ${GCC_EXTRA_OPTIONS} -pedantic -Wno-long-long -std=c++11 ${yaml_cxx_flags}") + set(yaml_cxx_flags "-Wall ${GCC_EXTRA_OPTIONS} -pedantic -Wno-long-long -std=c++11") ### Make specific if(${CMAKE_BUILD_TOOL} MATCHES make OR ${CMAKE_BUILD_TOOL} MATCHES gmake) @@ -217,7 +214,7 @@ if(MSVC) endif() # correct linker options - foreach(flag_var yaml_c_flags yaml_cxx_flags) + foreach(flag_var CMAKE_C_FLAGS CMAKE_CXX_FLAGS) foreach(config_name "" DEBUG RELEASE MINSIZEREL RELWITHDEBINFO) set(var_name "${flag_var}") if(NOT "${config_name}" STREQUAL "") @@ -243,7 +240,7 @@ if(MSVC) # /W3 = set warning level; see http://msdn.microsoft.com/en-us/library/thxezb7y.aspx # /wd4127 = disable warning C4127 "conditional expression is constant"; see http://msdn.microsoft.com/en-us/library/6t66728h.aspx # /wd4355 = disable warning C4355 "'this' : used in base member initializer list"; http://msdn.microsoft.com/en-us/library/3c594ae3.aspx - set(yaml_cxx_flags "/W3 /wd4127 /wd4355 ${yaml_cxx_flags}") + set(CMAKE_CXX_FLAGS "/W3 /wd4127 /wd4355 ${CMAKE_CXX_FLAGS}") endif() @@ -273,7 +270,7 @@ set(_INSTALL_DESTINATIONS ### add_library(yaml-cpp ${library_sources}) set_target_properties(yaml-cpp PROPERTIES - COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}" + COMPILE_FLAGS "${yaml_cxx_flags}" ) set_target_properties(yaml-cpp PROPERTIES diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 74c2594..041d220 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -27,7 +27,7 @@ add_executable(run-tests ${test_headers} ) set_target_properties(run-tests PROPERTIES - COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags} ${yaml_test_flags}" + COMPILE_FLAGS "${yaml_test_flags}" ) target_link_libraries(run-tests yaml-cpp gmock)