Commit a71cc9b2 authored by Ghislain MARY's avatar Ghislain MARY

Use bc_apply_compile_flags from bctoolbox CMake utils.

parent 3baac663
......@@ -35,21 +35,6 @@ option(ENABLE_STATIC "Build static library." ON)
option(ENABLE_STRICT "Build with strict compile options." YES)
option(ENABLE_UNIT_TESTS "Enable compilation of unit tests." YES)
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()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
......
......@@ -41,8 +41,8 @@ set(BELCARD_SOURCE_FILES_CXX
vcard_grammar.cpp
)
apply_compile_flags(BELCARD_SOURCE_FILES_C "CPP" "C")
apply_compile_flags(BELCARD_SOURCE_FILES_CXX "CPP" "CXX")
bc_apply_compile_flags(BELCARD_SOURCE_FILES_C STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
bc_apply_compile_flags(BELCARD_SOURCE_FILES_CXX STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
if(ENABLE_STATIC)
add_library(belcard-static STATIC ${BELCARD_HEADER_FILES} ${BELCARD_SOURCE_FILES_C} ${BELCARD_SOURCE_FILES_CXX})
......
......@@ -49,7 +49,7 @@ set(SOURCE_FILES_CXX
belcard-vcard-tester.cpp
)
apply_compile_flags(SOURCE_FILES_CXX "CPP" "CXX")
bc_apply_compile_flags(SOURCE_FILES_CXX STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
add_executable(belcard_tester ${SOURCE_FILES_CXX} ${HEADER_FILES_CXX})
set_target_properties(belcard_tester PROPERTIES LINKER_LANGUAGE CXX)
......
......@@ -28,7 +28,7 @@ endif()
foreach(EXECTUABLE belcard-folder belcard-unfolder belcard-parser)
set(SOURCE_FILES_CXX ${EXECTUABLE}.cpp)
apply_compile_flags(SOURCE_FILES_CXX "CPP" "CXX")
bc_apply_compile_flags(SOURCE_FILES_CXX STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
add_executable(${EXECTUABLE} ${SOURCE_FILES_CXX})
set_target_properties(${EXECTUABLE} PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(${EXECTUABLE} ${BELCARD_LIBRARIES_FOR_TOOLS} ${BELR_LIBRARIES})
......
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