forked from SergiusTheBest/plog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
25 lines (22 loc) · 1.4 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# some systems have no shared libraries support, so check it
if(NOT DEFINED TARGET_SUPPORTS_SHARED_LIBS OR TARGET_SUPPORTS_SHARED_LIBS)
# reset visibility to default to test more harsh conditions
# in real code it's recommended to use hidden visibility
set(CMAKE_CXX_VISIBILITY_PRESET default)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 0)
add_executable(NotSharedApp NotSharedApp/Main.cpp)
target_link_libraries(NotSharedApp PRIVATE plog::plog NotSharedLib1 NotSharedLib2)
set_target_properties(NotSharedApp PROPERTIES FOLDER Samples/NotShared)
# define PLOG_LOCAL to make plog instances local (not shared between shared objects)
target_compile_definitions(NotSharedApp PRIVATE PLOG_LOCAL)
add_library(NotSharedLib1 SHARED NotSharedLib1/Main.cpp)
target_link_libraries(NotSharedLib1 PRIVATE plog::plog)
set_target_properties(NotSharedLib1 PROPERTIES FOLDER Samples/NotShared)
# define PLOG_LOCAL to make plog instances local (not shared between shared objects)
target_compile_definitions(NotSharedLib1 PRIVATE PLOG_LOCAL)
add_library(NotSharedLib2 SHARED NotSharedLib2/Main.cpp)
target_link_libraries(NotSharedLib2 PRIVATE plog::plog)
set_target_properties(NotSharedLib2 PROPERTIES FOLDER Samples/NotShared)
# define PLOG_LOCAL to make plog instances local (not shared between shared objects)
target_compile_definitions(NotSharedLib2 PRIVATE PLOG_LOCAL)
endif()