2019-06-20 21:18:58 +08:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
|
|
|
|
set(libBasename JKQTMathText)
|
|
|
|
|
|
|
|
message( STATUS )
|
|
|
|
message( STATUS "-----------------------------------------------------------------------------" )
|
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
set(libsh_name ${libBasename}SharedLib)
|
|
|
|
set(${libsh_name}_LIBRARY ${libsh_name} PARENT_SCOPE)
|
|
|
|
message( STATUS "-- Building ${libsh_name}" )
|
|
|
|
endif(BUILD_SHARED_LIBS)
|
|
|
|
|
|
|
|
if(BUILD_STATIC_LIBS)
|
|
|
|
set(lib_name ${libBasename}Lib)
|
|
|
|
set(${lib_name}_LIBRARY ${lib_name} PARENT_SCOPE)
|
|
|
|
message( STATUS "-- Building ${lib_name}" )
|
|
|
|
endif(BUILD_STATIC_LIBS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Set up source files
|
|
|
|
set(SRCS
|
|
|
|
jkqtmathtext.cpp
|
2019-05-18 19:23:38 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
set(HEADERS
|
2019-06-20 21:18:58 +08:00
|
|
|
jkqtmathtext.h
|
|
|
|
)
|
|
|
|
|
|
|
|
if(BUILD_INCLUDE_XITS_FONTS)
|
|
|
|
set(RESOURCES
|
|
|
|
resources/xits.qrc
|
|
|
|
)
|
|
|
|
endif(BUILD_INCLUDE_XITS_FONTS)
|
|
|
|
|
|
|
|
|
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
add_library(${libsh_name} SHARED ${SRCS} ${HEADERS} ${RESOURCES})
|
|
|
|
set_property(TARGET ${libsh_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
|
|
|
target_link_libraries(${libsh_name} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport JKQTCommonSharedLib)
|
|
|
|
target_compile_definitions(${libsh_name} PRIVATE JKQTP_LIB_IN_DLL)
|
|
|
|
target_compile_definitions(${libsh_name} PRIVATE JKQTP_LIB_EXPORT_LIBRARY)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_STATIC_LIBS)
|
|
|
|
add_library(${lib_name} STATIC ${SRCS} ${HEADERS} ${RESOURCES})
|
|
|
|
set_property(TARGET ${lib_name} PROPERTY VERSION "${PROJECT_VERSION}")
|
|
|
|
target_link_libraries(${lib_name} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport JKQTCommonLib)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Installation
|
|
|
|
if(LIB_INSTALL)
|
|
|
|
|
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
install(TARGETS ${libsh_name} EXPORT ${libsh_name}_TARGETS
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
2019-06-20 22:06:31 +08:00
|
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/jkqtmathtext
|
2019-06-20 21:18:58 +08:00
|
|
|
)
|
|
|
|
endif(BUILD_SHARED_LIBS)
|
|
|
|
|
|
|
|
if(BUILD_STATIC_LIBS)
|
|
|
|
install(TARGETS ${lib_name} EXPORT ${lib_name}_TARGETS
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
2019-06-20 22:06:31 +08:00
|
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/jkqtmathtext
|
2019-06-20 21:18:58 +08:00
|
|
|
)
|
|
|
|
endif(BUILD_STATIC_LIBS)
|
|
|
|
|
|
|
|
install(FILES ${HEADERS}
|
2019-06-20 22:06:31 +08:00
|
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/jkqtmathtext
|
2019-06-20 21:18:58 +08:00
|
|
|
COMPONENT Headers)
|
|
|
|
|
|
|
|
endif(LIB_INSTALL)
|