Commit a000c79c authored by Ghislain MARY's avatar Ghislain MARY

Fix strict compile flags.

parent 282cbc94
......@@ -38,6 +38,7 @@ set(PROJECT_VERSION_MINOR ${BCTOOLBOX_VERSION_MINOR})
set(PROJECT_VERSION_PATCH ${BCTOOLBOX_VERSION_PATCH})
set(PROJECT_VERSION "${BCTOOLBOX_VERSION}")
option(ENABLE_SHARED "Build shared library." ON)
option(ENABLE_STATIC "Build static library." ON)
option(ENABLE_POLARSSL "Enable polarssl support" ON)
......@@ -46,6 +47,23 @@ option(ENABLE_STRICT "Pass strict flags to the compiler" ON)
option(ENABLE_TESTS_COMPONENT "Enable compilation of tests helper library" ON)
option(ENABLE_TESTS "Enable compilation of tests" ON)
macro(apply_compile_flags SOURCE_FILES)
if(${SOURCE_FILES})
set(options "")
foreach(a ${ARGV})
if(STRICT_OPTIONS_${a})
string(REPLACE ";" " " options_${a} "${STRICT_OPTIONS_${a}}")
set(options "${options} ${options_${a}}")
endif()
endforeach()
if(options)
set_source_files_properties(${${SOURCE_FILES}} PROPERTIES COMPILE_FLAGS "${options}")
endif()
endif()
endmacro()
include(CheckLibraryExists)
include(CheckSymbolExists)
include(CheckCSourceCompiles)
......
......@@ -45,26 +45,9 @@ endif()
set(BCTOOLBOX_SOURCE_FILES ${BCTOOLBOX_C_SOURCE_FILES} ${BCTOOLBOX_CXX_SOURCE_FILES})
set(BCTOOLBOX_TESTER_SOURCE_FILES ${BCTOOLBOX_C_TESTER_SOURCE_FILES})
if(STRICT_OPTIONS_CPP)
set_source_files_properties(
${BCTOOLBOX_C_SOURCE_FILES}
${BCTOOLBOX_CXX_SOURCE_FILES}
${BCTOOLBOX_C_TESTER_SOURCE_FILES}
PROPERTIES COMPILE_FLAGS "${STRICT_OPTIONS_CPP}"
)
endif()
if(STRICT_OPTIONS_C)
set_source_files_properties(
${BCTOOLBOX_C_SOURCE_FILES}
${BCTOOLBOX_C_TESTER_SOURCE_FILES}
PROPERTIES COMPILE_FLAGS "${STRICT_OPTIONS_C}"
)
endif()
if(STRICT_OPTIONS_CXX)
set_source_files_properties(
${BCTOOLBOX_CXX_SOURCE_FILES}
PROPERTIES COMPILE_FLAGS "${STRICT_OPTIONS_CXX}")
endif()
apply_compile_flags(BCTOOLBOX_C_SOURCE_FILES_C "CPP" "C")
apply_compile_flags(BCTOOLBOX_C_TESTER_SOURCE_FILES_C "CPP" "C")
apply_compile_flags(BCTOOLBOX_CXX_SOURCE_FILES_C "CPP" "CXX")
if(ENABLE_STATIC)
add_library(bctoolbox-static STATIC ${BCTOOLBOX_SOURCE_FILES})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment