COMPASSi/trunk/code/projects/Util/CMakeLists.txt

71 lines
1.5 KiB
CMake
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

cmake_minimum_required(VERSION 3.5)
project(Util)
# 符号导出
add_definitions(-DUTILITY_LIB)
# 设置编译选项Linux 不需要 /MP
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
if(WIN32)
set(CMAKE_DEBUG_POSTFIX "d")
else()
set(CMAKE_DEBUG_POSTFIX "d")
endif()
# 使用 UTF-8 编码
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
find_package(Qt5 COMPONENTS Core Widgets WebChannel WebEngineWidgets Svg Sql Xml REQUIRED)
include_directories(${PROJECTS_PATH}/inc/Util/include)
if(WIN32)
include_directories(${PROJECTS_PATH}/3rd/spdlog/win64/include)
else()
include_directories(${PROJECTS_PATH}/3rd/spdlog/arm_linux/include)
endif()
# 添加库文件搜索路径
if(WIN32)
link_directories(${PROJECTS_PATH}/3rd/spdlog/win64/lib)
else()
link_directories(${PROJECTS_PATH}/3rd/spdlog/arm_linux/lib)
endif()
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src/ srcs_util)
file(GLOB HEADER_FILES ${PROJECTS_PATH}/inc/Util/include/*.h)
add_library(${PROJECT_NAME} SHARED ${srcs_util} ${HEADER_FILES})
target_include_directories(Util PRIVATE ${CMAKE_SOURCE_DIR}/3rd/spdlog)
target_link_libraries(${PROJECT_NAME} PUBLIC
Qt5::Widgets
Qt5::Core
Qt5::Svg
Qt5::WebChannel
Qt5::WebEngineWidgets
Qt5::Xml
Qt5::Sql
)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_link_libraries(${PROJECT_NAME} PUBLIC spdlogd)
else()
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog)
endif()