comparison CMakeLists.txt @ 110:2f3ae79adb02

cmake: fix what I tried to do in the last commit
author Paper <mrpapersonic@gmail.com>
date Mon, 06 Nov 2023 01:58:57 -0500
parents 79714c95a145
children 80f49f623d30
comparison
equal deleted inserted replaced
109:79714c95a145 110:2f3ae79adb02
10 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") 10 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
11 11
12 option(BUILD_SHARED_LIBS "Build using shared libraries" ON) 12 option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
13 option(USE_QT6 "Force build with Qt 6" OFF) 13 option(USE_QT6 "Force build with Qt 6" OFF)
14 option(USE_QT5 "Force build with Qt 5" OFF) 14 option(USE_QT5 "Force build with Qt 5" OFF)
15 option(UPDATE_TRANSLATIONS "Update *.ts translation files" OFF) 15 # The reason I'm not specifying this an an option() is that
16 # that will *save the value*, which causes the *.qm translation
17 # files to not automatically be generated, screwing up the whole
18 # "automation" part of it.
19 #
20 # Ugh.
21 #
22 # option(UPDATE_TRANSLATIONS "Update *.ts translation files" OFF)
16 23
17 add_subdirectory(dep/anitomy) 24 add_subdirectory(dep/anitomy)
18 add_subdirectory(dep/animia) 25 add_subdirectory(dep/animia)
19 add_subdirectory(dep/pugixml) 26 add_subdirectory(dep/pugixml)
20 27
21 # Fix for mingw64 28 # Fix for mingw64
22 list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a") 29 list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a")
23 30
24 if (USE_QT6) 31 if(USE_QT6)
25 set(QT_VERSION_MAJOR 6) 32 set(QT_VERSION_MAJOR 6)
26 elseif(USE_QT5) 33 elseif(USE_QT5)
27 set(QT_VERSION_MAJOR 5) 34 set(QT_VERSION_MAJOR 5)
28 else() 35 else()
29 find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) 36 find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
122 ) 129 )
123 130
124 set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/rc/locale") 131 set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/rc/locale")
125 132
126 # dumb little hack to get this working on Qt5 and Qt6 133 # dumb little hack to get this working on Qt5 and Qt6
127 if (UPDATE_TRANSLATIONS) 134 if(UPDATE_TRANSLATIONS)
128 cmake_language(CALL qt${QT_VERSION_MAJOR}_create_translation ${SRC_FILES} ${TS_FILES} OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}/include") 135 cmake_language(CALL qt${QT_VERSION_MAJOR}_create_translation ${SRC_FILES} ${TS_FILES} OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}/include")
129 endif() 136 endif()
130 cmake_language(CALL qt${QT_VERSION_MAJOR}_add_translation QM_FILES ${TS_FILES}) 137 cmake_language(CALL qt${QT_VERSION_MAJOR}_add_translation QM_FILES ${TS_FILES})
131 add_custom_target(translation ALL SOURCES ${QM_FILES} DEPENDS ${TS_FILES}) 138 add_custom_target(translation SOURCES ${QM_FILES} DEPENDS ${TS_FILES})
132 139
133 function(qt_create_resource_file outfile) 140 function(qt_create_resource_file outfile)
134 set(QRC "<!DOCTYPE rcc><RCC version=\"1.0\">\n\t<qresource>\n") 141 set(QRC "<!DOCTYPE rcc><RCC version=\"1.0\">\n\t<qresource>\n")
135 get_filename_component(DIR ${outfile} DIRECTORY) 142 get_filename_component(DIR ${outfile} DIRECTORY)
136 foreach (qm ${ARGN}) 143 foreach (qm ${ARGN})