File tree Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 33
33
set (NOT_DEBUG_MODE ON )
34
34
endif ()
35
35
36
+ # Function to link external libraries as system libraries
37
+ include (cmake/LinkExternalLibraries.cmake )
38
+
36
39
#######################################################
37
40
### Options ###
38
41
#######################################################
Original file line number Diff line number Diff line change
1
+ function (target_link_libraries_system target )
2
+ set (options PRIVATE PUBLIC INTERFACE )
3
+ cmake_parse_arguments (TLLS "${options} " "" "" ${ARGN} )
4
+ foreach (op ${options} )
5
+ if (TLLS_${op} )
6
+ set (scope ${op} )
7
+ endif ()
8
+ endforeach (op )
9
+ set (libs ${TLLS_UNPARSED_ARGUMENTS} )
10
+
11
+ foreach (lib ${libs} )
12
+ get_target_property (lib_include_dirs ${lib} INTERFACE_INCLUDE_DIRECTORIES )
13
+ if (lib_include_dirs )
14
+ if (scope )
15
+ target_include_directories (${target} SYSTEM ${scope} ${lib_include_dirs} )
16
+ else ()
17
+ target_include_directories (${target} SYSTEM PRIVATE ${lib_include_dirs} )
18
+ endif ()
19
+ else ()
20
+ message ("Warning: ${lib} doesn't set INTERFACE_INCLUDE_DIRECTORIES. No include_directories set." )
21
+ endif ()
22
+ if (scope )
23
+ target_link_libraries (${target} ${scope} ${lib} )
24
+ else ()
25
+ target_link_libraries (${target} ${lib} )
26
+ endif ()
27
+ endforeach ()
28
+ endfunction (target_link_libraries_system )
Original file line number Diff line number Diff line change @@ -90,8 +90,8 @@ target_include_directories(matplot
90
90
PUBLIC $< BUILD_INTERFACE:${MATPLOT_ROOT_DIR} /source>
91
91
$< INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} > )
92
92
93
- target_link_libraries (matplot
94
- PRIVATE cimg nodesoup std::filesystem )
93
+ target_link_libraries_system (matplot
94
+ PRIVATE cimg nodesoup std::filesystem )
95
95
96
96
# https://cmake.org/cmake/help/v3.14/manual/cmake-compile-features.7.html#requiring-language-standards
97
97
target_compile_features (matplot PUBLIC cxx_std_17 )
@@ -242,4 +242,4 @@ if (BUILD_INSTALLER)
242
242
NAMESPACE Matplot++::
243
243
DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/Matplot++
244
244
)
245
- endif ()
245
+ endif ()
You can’t perform that action at this time.
0 commit comments