first test CMakeLists.txt

This commit is contained in:
jkriege2 2019-05-18 13:23:38 +02:00
parent 5f62722d38
commit 04aaa01333
5 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.1)
# configure compiler
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED on)
if(MINGW)
# COMPILER-SETTINGS FOR MINGW
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
elseif(MSVC)
# COMPILER-SETTINGS FOR MS VISUAL C++
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
# To enable M_PI, M_E,...
add_definitions(/D_USE_MATH_DEFINES)
# To fix error: C2338: va_start argument must not
# have reference type and must not be parenthesized
add_definitions(/D_CRT_NO_VA_START_VALIDATION)
endif()

1
common_include.cmake Normal file
View File

@ -0,0 +1 @@
cmake_minimum_required(VERSION 3.1)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.1)
# common definitions
include(../../common_include.cmake)
set(SOURCE
${SOURCE}
${CMAKE_CURRENT_SOURCE_DIR}/jkqtptools.cpp
PARENT_SCOPE
)
set(HEADERS
${HEADERS}
${CMAKE_CURRENT_SOURCE_DIR}/jkqtptools.h
${CMAKE_CURRENT_SOURCE_DIR}/jkqtp_imexport.h
PARENT_SCOPE
)

View File

@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.1)
# common definitions
include(../../common_include.cmake)
set(SOURCE
${SOURCE}
${CMAKE_CURRENT_SOURCE_DIR}/jkqtmathtext.cpp
PARENT_SCOPE
)
set(HEADERS
${HEADERS}
${CMAKE_CURRENT_SOURCE_DIR}/jkqtmathtext.h
PARENT_SCOPE
)

View File

@ -0,0 +1,44 @@
cmake_minimum_required(VERSION 3.1)
# common definitions
include(../../common_include.cmake)
IF(CMAKE_BUILD_TYPE MATCHES RELEASE)
SET(LIB_NAME libjkqtmathtext_static)
ELSE()
SET(LIB_NAME libjkqtmathtext_static_debug)
ENDIF(CMAKE_BUILD_TYPE MATCHES RELEASE)
# configure compiler
include(${CMAKE_CURRENT_SOURCE_DIR}/../../common_compilersettings.cmake)
# Find the QtWidgets library
find_package(Qt5 COMPONENTS Core Gui PrintSupport CONFIG REQUIRED)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed
set(CMAKE_AUTOMOC ON)
# Create code from a list of Qt designer ui files
set(CMAKE_AUTOUIC ON)
# All build libraries are moved to this directory
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
message(${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../lib/jkqtcommon/)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../lib/jkqtmathtext/)
# define output library and properties
ADD_LIBRARY(${LIB_NAME} ${SOURCES} ${HEADERS})
INSTALL(TARGETS ${LIB_NAME} DESTINATION bin)
# define target
target_link_libraries(${LIB_NAME} Qt5::Core Qt5::Widgets Qt5::PrintSupport)
#target_compile_features(${LIB_NAME} PUBLIC cxx_std_11)
target_include_directories(${LIB_NAME} PUBLIC "../../lib/jkqtmathtext/")
#export(TARGETS ${LIB_NAME})