Add flags for compiler warnings/errors for Mac and Linux

This commit is contained in:
Alexander Bock
2015-05-24 00:34:03 +02:00
parent 98024ca29d
commit cedf379623
2 changed files with 16 additions and 5 deletions

View File

@@ -103,6 +103,9 @@ function (set_common_compile_settings target_name)
endif ()
target_compile_options(${library_name} PUBLIC "-stdlib=libc++")
if (OPENSPACE_WARNINGS_AS_ERRORS)
target_compile_options(${library_name} PUBLIC "-Werror")
endif ()
elseif (UNIX)
include (CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
@@ -117,6 +120,9 @@ function (set_common_compile_settings target_name)
endif ()
target_compile_definitions(${library_name} PUBLIC "-ggdb")
if (OPENSPACE_WARNINGS_AS_ERRORS)
target_compile_options(${library_name} PUBLIC "-Werror")
endif ()
endif ()
endfunction ()

View File

@@ -81,8 +81,13 @@ function (set_compile_settings)
if (MSVC)
target_compile_options(libOpenSpace PUBLIC "/MP" "/wd4201" "/wd4127")
if (OPENSPACE_WARNINGS_AS_ERRORS)
target_compile_options(libOpenSpace PUBLIC "/WX")
target_compile_options(OpenSpace PUBLIC "/WX")
if (MSVC)
target_compile_options(libOpenSpace PUBLIC "/WX")
target_compile_options(OpenSpace PUBLIC "/WX")
else ()
target_compile_options(libOpenSpace PUBLIC "-Werror")
target_compile_options(OpenSpace PUBLIC "-Werror")
endif ()
endif ()
set_target_properties(OpenSpace PROPERTIES LINK_FLAGS
@@ -181,7 +186,7 @@ function (add_external_dependencies)
if (MSVC)
target_compile_options(ccmc PUBLIC "/W0" "/MP")
else ()
message("Fill me will values ---abock")
target_compile_options(ccmc PUBLIC "-w")
endif ()
target_compile_definitions(ccmc PUBLIC "_SCL_SECURE_NO_WARNINGS")
endif ()
@@ -191,7 +196,7 @@ function (add_external_dependencies)
if (MSVC)
target_compile_options(cdf PUBLIC "/W0" "/MP")
else ()
message("Fill me will values ---abock")
target_compile_options(ccmc PUBLIC "-w")
endif ()
endif ()
set_property(TARGET cdf PROPERTY FOLDER "External")
@@ -207,7 +212,7 @@ function (add_external_dependencies)
if (MSVC)
target_compile_options(Imgui PUBLIC "/W0" "/MP")
else ()
message("Fill me will values ---abock")
target_compile_options(ccmc PUBLIC "-w")
endif ()
endif ()
endfunction ()