File tree Expand file tree Collapse file tree 3 files changed +24
-10
lines changed Expand file tree Collapse file tree 3 files changed +24
-10
lines changed Original file line number Diff line number Diff line change 1919cmake_minimum_required (VERSION 3.16)
2020project (ecal_service)
2121
22+ # Root CMakeLists sets CMAKE_MODULE_PATH to include the correct path
23+ # If the module cannot be found warnings basic warnings will be applied instead
24+ include (helper_functions/ecal_compiler_warnings OPTIONAL RESULT_VARIABLE _ecal_warnings_found)
25+ if ("${_ecal_warnings_found} " STREQUAL "NOTFOUND" )
26+ message (AUTHOR_WARNING
27+ " helper_functions/ecal_compiler_warnings.cmake not found.\n "
28+ " Add the path to CMAKE_MODULE_PATH to use warnings specified by the main eCAL repo."
29+ )
30+ add_library (_ecal_service_warnings INTERFACE )
31+ set (cxx_compiler_flags "" )
32+ if ("${CMAKE_CXX_COMPILER_ID} " MATCHES "MSVC" )
33+ set (cxx_compiler_flags "/MP" "/W4" )
34+ elseif ("${CMAKE_CXX_COMPILER_ID} " MATCHES "GNU|Clang" )
35+ set (cxx_compiler_flags "-Wall" "-Wextra" )
36+ else ()
37+ message (WARNING "Unknown compiler, will not set warning flags" )
38+ endif ()
39+ target_compile_options (_ecal_service_warnings INTERFACE "${cxx_compiler_flags} " )
40+ else ()
41+ add_library (_ecal_service_warnings ALIAS _ecal_warnings)
42+ endif ()
43+
2244# Main library
2345add_subdirectory (ecal_service)
2446
Original file line number Diff line number Diff line change 1- cmake_minimum_required (VERSION 3.5.1 )
1+ cmake_minimum_required (VERSION 3.16 )
22
33project (ecal_service)
44
@@ -61,6 +61,7 @@ target_link_libraries(${PROJECT_NAME}
6161 Threads::Threads
6262 $<$<BOOL :${WIN32} >:ws2_32>
6363 $<$<BOOL :${WIN32} >:wsock32>
64+ _ecal_service_warnings
6465
6566)
6667
@@ -72,12 +73,6 @@ target_compile_definitions(${PROJECT_NAME}
7273
7374target_compile_features (${PROJECT_NAME} PUBLIC cxx_std_14)
7475
75- target_compile_options (${PROJECT_NAME} PRIVATE
76- $<$<OR :$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
77- -Wall -Wextra>
78- $<$<CXX_COMPILER_ID:MSVC >:
79- /W4>)
80-
8176# Add own public include directory
8277target_include_directories (${PROJECT_NAME}
8378 PUBLIC
Original file line number Diff line number Diff line change @@ -45,9 +45,6 @@ set(sources
4545# QEcalParser is an internal implementation detail for applications so it can
4646# always be static and not installed/exported
4747ecal_add_static_library(${PROJECT_NAME}
48- ${includes}
49- ${sources}
50- )
5148
5249target_include_directories (${PROJECT_NAME} PUBLIC include /)
5350target_include_directories (${PROJECT_NAME} PRIVATE src/)
You can’t perform that action at this time.
0 commit comments