mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2025-12-23 22:37:53 -05:00
Build: Add a set of interface targets which can be used to set compilation options
zm-compile-option-interface: Use to set various compiler/linker flags zm-feature-interface: Use to set required compiler features. See https://cmake.org/cmake/help/latest/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html zm-warning-interface: Use to set compiler warning flags. If need be a zm-no-warning-interface can be added which suppresses all warning for targets linked against it. Useful for in-tree dependencies from which we don't want compiler warnings. zm-core-interface: That's the interface one should normally link against to get all the options.
This commit is contained in:
@@ -44,6 +44,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
include(ConfigureBaseTargets)
|
||||
include(CheckPlatform)
|
||||
|
||||
# GCC below 6.0 doesn't support __target__("fpu=neon") attribute, required for compiling ARM Neon code, otherwise compilation fails.
|
||||
|
||||
29
cmake/Modules/ConfigureBaseTargets.cmake
Normal file
29
cmake/Modules/ConfigureBaseTargets.cmake
Normal file
@@ -0,0 +1,29 @@
|
||||
add_library(zm-compile-option-interface INTERFACE)
|
||||
|
||||
# Use -std=c++11 instead of -std=gnu++11
|
||||
set(CXX_EXTENSIONS OFF)
|
||||
|
||||
add_library(zm-feature-interface INTERFACE)
|
||||
|
||||
target_compile_features(zm-feature-interface
|
||||
INTERFACE
|
||||
cxx_std_11)
|
||||
|
||||
# Interface to set warning levels on targets
|
||||
# It gets populated in the compiler specific script
|
||||
add_library(zm-warning-interface INTERFACE)
|
||||
|
||||
# An interface used by all other interfaces
|
||||
add_library(zm-default-interface INTERFACE)
|
||||
target_link_libraries(zm-default-interface
|
||||
INTERFACE
|
||||
zm-compile-option-interface
|
||||
zm-feature-interface)
|
||||
|
||||
# An interface which provides the flags and definitions
|
||||
# used by the non-dependency targets.
|
||||
add_library(zm-core-interface INTERFACE)
|
||||
target_link_libraries(zm-core-interface
|
||||
INTERFACE
|
||||
zm-default-interface
|
||||
zm-warning-interface)
|
||||
Reference in New Issue
Block a user