Kylin/Universal/CMakeLists.txt
2024-09-16 01:32:40 +08:00

47 lines
1.3 KiB
CMake

find_package(Boost REQUIRED COMPONENTS log log_setup program_options)
add_library(Universal
ApplicationSettings.h
BoostLog.h BoostLog.inl BoostLog.cpp
BufferUtility.h BufferUtility.cpp
DateTime.h DateTime.cpp
FunctionTraits.h
IoContext.h IoContext.cpp
MessageManager.h MessageManager.inl MessageManager.cpp
ProcessUtility.h ProcessUtility.inl ProcessUtility.cpp
Singleton.h
SingletonProcess.h SingletonProcess.cpp
StreamFormat.h StreamFormat.inl StreamFormat.cpp
StringUtility.h StringUtility.cpp
)
set_property(TARGET Universal
PROPERTY POSITION_INDEPENDENT_CODE ON
)
if(CMAKE_VERSION VERSION_LESS 3.20)
get_filename_component(KYLIN_CORE_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
if(NOT Boost_USE_STATIC_LIBS)
target_compile_definitions(Universal
PUBLIC BOOST_LOG_DYN_LINK
)
endif()
else()
cmake_path(GET CMAKE_CURRENT_SOURCE_DIR PARENT_PATH KYLIN_CORE_INCLUDE_PATH)
endif()
if(DISABLE_LOG)
target_compile_definitions(Universal
PUBLIC DISABLE_LOG
)
endif()
target_include_directories(Universal
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
INTERFACE ${KYLIN_CORE_INCLUDE_PATH}
PUBLIC ${Boost_INCLUDE_DIRS}
)
target_link_libraries(Universal
PUBLIC ${Boost_LIBRARIES}
)