@@ -10,16 +10,37 @@ set(LIBRARY_SOURCES
1010 ${SRCROOT} /Lib.cpp
1111)
1212
13- # Define library and its properties
14- add_library (Core STATIC ${LIBRARY_HEADERS} ${LIBRARY_SOURCES} )
13+ # ---- Define library ----
14+ add_library (Core ${LIBRARY_HEADERS} ${LIBRARY_SOURCES} )
1515target_include_directories (Core PUBLIC ${PROJECT_SOURCE_DIR} /library/include )
1616target_compile_features (Core PUBLIC cxx_std_17)
17+
18+ include (GenerateExportHeader)
19+ generate_export_header(Core
20+ EXPORT_FILE_NAME Core_Export.h
21+ EXPORT_MACRO_NAME CORE_API
22+ NO_EXPORT_MACRO_NAME CORE_PRIVATE
23+ )
24+ target_sources (Core
25+ PUBLIC
26+ FILE_SET HEADERS
27+ BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}
28+ FILES ${CMAKE_CURRENT_BINARY_DIR} /Core_Export.h
29+ )
30+
31+ if (NOT BUILD_SHARED_LIBS )
32+ target_compile_definitions (Core PUBLIC CORE_STATIC_DEFINE)
33+ endif ()
34+
35+ set_target_properties (Core PROPERTIES
36+ CXX_VISIBILITY_PRESET hidden
37+ VISIBILITY_INLINES_HIDDEN YES
38+ VERSION "${PROJECT_VERSION} "
39+ SOVERSION "${PROJECT_VERSION_MAJOR} "
40+ )
41+
1742install (TARGETS Core)
1843
1944if (FEATURE_TESTS)
2045 add_subdirectory (${PROJECT_SOURCE_DIR} /library/test )
2146endif ()
22-
23- # Group headers and sources for IDE
24- source_group (TREE ${INCROOT} PREFIX "Headers" FILES ${LIBRARY_HEADERS} )
25- source_group (TREE ${SRCROOT} PREFIX "Sources" FILES ${LIBRARY_SOURCES} )
0 commit comments