qt5base-lts/cmake/QtConfigureTimeExecutableCMakeLists.txt.in
Alexey Edelev ac74b60c9c Add function to add and compile executables at configure time
qt_internal_add_configure_time_executable compiles the executable
at configure time and exposes it to the CMake source tree. This is
useful when need to run a small C++ program at configure time.

Task-number: QTBUG-87480
Change-Id: I031efe797c8afa0721d75b46d4f36f67276bf46e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-13 00:50:47 +02:00

22 lines
693 B
Plaintext

cmake_minimum_required(VERSION 3.16)
project(@configure_time_target@ LANGUAGES CXX)
set(packages "@packages@")
set(defines @defines@)
set(compile_options @compile_options@)
set(link_options @link_options@)
foreach(package IN LISTS packages)
find_package(${package} REQUIRED)
endforeach()
add_executable(@configure_time_target@ @win32@ @macosx_bundle@ @sources@)
set_target_properties(@configure_time_target@ PROPERTIES
INCLUDE_DIRECTORIES "@include_directories@"
)
target_compile_options(@configure_time_target@ PRIVATE ${compile_options})
target_compile_definitions(@configure_time_target@ PRIVATE ${defines})
target_link_options(@configure_time_target@ PRIVATE ${link_options})