Update CMake files to possibly work on windows

This commit is contained in:
AdenKoperczak 2024-10-28 10:14:49 -04:00
parent b5a89b51db
commit 8e114c555f
2 changed files with 17 additions and 7 deletions

View file

@ -11,7 +11,8 @@ set_property(DIRECTORY
maplibre-native-qt.cmake maplibre-native-qt.cmake
stb.cmake stb.cmake
textflowcpp.cmake textflowcpp.cmake
units.cmake) units.cmake
qt6ct.cmake)
include(aws-sdk-cpp.cmake) include(aws-sdk-cpp.cmake)
include(date.cmake) include(date.cmake)

21
external/qt6ct.cmake vendored
View file

@ -1,6 +1,13 @@
cmake_minimum_required(VERSION 3.16.0) cmake_minimum_required(VERSION 3.16.0)
set(PROJECT_NAME scwx-qt6ct) set(PROJECT_NAME scwx-qt6ct)
find_package(QT NAMES Qt6
COMPONENTS Gui
REQUIRED)
find_package(Qt${QT_VERSION_MAJOR}
COMPONENTS Gui
REQUIRED)
#extract version from qt6ct.h #extract version from qt6ct.h
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/qt6ct/src/qt6ct-common/qt6ct.h" file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/qt6ct/src/qt6ct-common/qt6ct.h"
QT6CT_VERSION_DATA REGEX "^#define[ \t]+QT6CT_VERSION_[A-Z]+[ \t]+[0-9]+.*$") QT6CT_VERSION_DATA REGEX "^#define[ \t]+QT6CT_VERSION_[A-Z]+[ \t]+[0-9]+.*$")
@ -17,18 +24,20 @@ else()
message(FATAL_ERROR "invalid header") message(FATAL_ERROR "invalid header")
endif() endif()
add_definitions(-DQT6CT_LIBRARY)
set(app_SRCS set(app_SRCS
qt6ct/src/qt6ct-common/qt6ct.cpp qt6ct/src/qt6ct-common/qt6ct.cpp
) )
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/qt6ct/src/qt6ct-common)
add_library(qt6ct-common STATIC ${app_SRCS}) add_library(qt6ct-common STATIC ${app_SRCS})
set_target_properties(qt6ct-common PROPERTIES VERSION ${QT6CT_VERSION}) set_target_properties(qt6ct-common PROPERTIES VERSION ${QT6CT_VERSION})
target_link_libraries(qt6ct-common PRIVATE Qt6::Gui) target_link_libraries(qt6ct-common PRIVATE Qt6::Gui)
install(TARGETS qt6ct-common DESTINATION ${CMAKE_INSTALL_LIBDIR}) target_compile_definitions(qt6ct-common PRIVATE QT6CT_LIBRARY)
if (MSVC)
# Produce PDB file for debug
target_compile_options(qt6ct-common PRIVATE "$<$<CONFIG:Release>:/Zi>")
else()
target_compile_options(qt6ct-common PRIVATE "$<$<CONFIG:Release>:-g>")
endif()
set_target_properties(qt6ct-common PROPERTIES PUBLIC_HEADER qt6ct/src/qt6ct-common/qt6ct.h)
target_include_directories( qt6ct-common INTERFACE qt6ct/src ) target_include_directories( qt6ct-common INTERFACE qt6ct/src )