mirror of
https://github.com/QtExcel/QXlsx.git
synced 2025-01-30 05:02:52 +08:00
set new cmake file for lib & console application
This commit is contained in:
parent
dddf63eb48
commit
87afa71f44
81
HelloWorld/CMakeLists.txt
Normal file
81
HelloWorld/CMakeLists.txt
Normal file
@ -0,0 +1,81 @@
|
||||
# CMakeLists.txt for HelloWorld (Console Application)
|
||||
|
||||
# TODO: Set minumum cmake version
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
# TODO: Set project name
|
||||
project(HelloWorld LANGUAGES CXX)
|
||||
|
||||
##########################
|
||||
# bolier-plate code (1) {{
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui REQUIRED)
|
||||
|
||||
if(NOT DEFINED ${QXLSX_PARENTPATH})
|
||||
set(QXLSX_PARENTPATH ${CMAKE_CURRENT_SOURCE_DIR}/../)
|
||||
endif(NOT DEFINED ${QXLSX_PARENTPATH})
|
||||
|
||||
if(NOT DEFINED ${QXLSX_HEADERPATH})
|
||||
set(QXLSX_HEADERPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/header/)
|
||||
endif(NOT DEFINED ${QXLSX_HEADERPATH})
|
||||
|
||||
if(NOT DEFINED ${QXLSX_SOURCEPATH})
|
||||
set(QXLSX_SOURCEPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/source/)
|
||||
endif(NOT DEFINED ${QXLSX_SOURCEPATH})
|
||||
|
||||
message("Current Path of QXlsx")
|
||||
message(${QXLSX_PARENTPATH})
|
||||
message(${QXLSX_HEADERPATH})
|
||||
message(${QXLSX_SOURCEPATH})
|
||||
|
||||
include_directories(${QXLSX_HEADERPATH})
|
||||
|
||||
file(GLOB QXLSX_CPP "${QXLSX_SOURCEPATH}/*.cpp")
|
||||
file(GLOB QXLSX_H "${QXLSX_HEADERPATH}/*.h")
|
||||
|
||||
set(SRC_FILES ${QXLSX_CPP})
|
||||
list(APPEND SRC_FILES ${QXLSX_H})
|
||||
|
||||
# bolier-plate code (1) }}
|
||||
###########################
|
||||
|
||||
####################
|
||||
# HelloWorld {{
|
||||
|
||||
# TODO: set your source code
|
||||
set(APP_SRC_FILES
|
||||
main.cpp)
|
||||
|
||||
list(APPEND SRC_FILES ${APP_SRC_FILES})
|
||||
add_executable(${PROJECT_NAME} ${SRC_FILES})
|
||||
|
||||
# HelloWorld }}
|
||||
####################
|
||||
|
||||
##########################
|
||||
# bolier-plate code (2) {{
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||
${QXLSX_HEADERPATH}
|
||||
${CMAKE_CURRENT_SOURCE_DIR} )
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::GuiPrivate
|
||||
)
|
||||
|
||||
set(CMAKE_WIN32_EXECUTABLE OFF)
|
||||
|
||||
# bolier-plate code (2) }}
|
||||
##########################
|
||||
|
@ -1,36 +1,52 @@
|
||||
# QXlsx
|
||||
# CMakeLists.txt for QXlsx Library
|
||||
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
project(QXlsx LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Gui REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui REQUIRED)
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui REQUIRED)
|
||||
|
||||
set(QXLSX_PARENTPATH ${CMAKE_CURRENT_SOURCE_DIR}/../)
|
||||
set(QXLSX_HEADERPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/header/)
|
||||
set(QXLSX_SOURCEPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/source/)
|
||||
if(NOT DEFINED ${QXLSX_PARENTPATH})
|
||||
set(QXLSX_PARENTPATH ${CMAKE_CURRENT_SOURCE_DIR}/../)
|
||||
endif(NOT DEFINED ${QXLSX_PARENTPATH})
|
||||
|
||||
if(NOT DEFINED ${QXLSX_HEADERPATH})
|
||||
set(QXLSX_HEADERPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/header/)
|
||||
endif(NOT DEFINED ${QXLSX_HEADERPATH})
|
||||
|
||||
if(NOT DEFINED ${QXLSX_SOURCEPATH})
|
||||
set(QXLSX_SOURCEPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/source/)
|
||||
endif(NOT DEFINED ${QXLSX_SOURCEPATH})
|
||||
|
||||
message("Current Path of QXlsx")
|
||||
message(${QXLSX_PARENTPATH})
|
||||
message(${QXLSX_HEADERPATH})
|
||||
message(${QXLSX_SOURCEPATH})
|
||||
|
||||
add_library(QXlsx STATIC)
|
||||
file(GLOB QXLSX_CPP "${QXLSX_SOURCEPATH}/*.cpp")
|
||||
file(GLOB QXLSX_H "${QXLSX_HEADERPATH}/*.h")
|
||||
|
||||
file(GLOB_RECURSE BAR "${QXLSX_SOURCEPATH}/*.cpp")
|
||||
file(GLOB_RECURSE BAR "${QXLSX_HEADERPATH}/*.h")
|
||||
set(SRC_FILES ${QXLSX_CPP})
|
||||
list(APPEND SRC_FILES ${QXLSX_H})
|
||||
|
||||
add_library(QXlsx STATIC
|
||||
${SRC_FILES} )
|
||||
|
||||
target_include_directories(QXlsx PRIVATE ${QXLSX_HEADERPATH})
|
||||
|
||||
target_link_libraries(QXlsx PRIVATE Qt${QT_VERSION_MAJOR}::Gui)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::GuiPrivate
|
||||
)
|
||||
|
||||
target_compile_definitions(QXlsx PRIVATE QXLSX_LIBRARY)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user