diff options
Diffstat (limited to 'src/corelib/Qt5CoreMacros.cmake')
-rw-r--r-- | src/corelib/Qt5CoreMacros.cmake | 111 |
1 files changed, 53 insertions, 58 deletions
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index 17cc19fc4e..e298cf7de7 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -39,7 +39,7 @@ include(CMakeParseArguments) # macro used to create the names of output files preserving relative dirs -macro(QT5_MAKE_OUTPUT_FILE infile prefix ext outfile ) +macro(qt5_make_output_file infile prefix ext outfile ) string(LENGTH ${CMAKE_CURRENT_BINARY_DIR} _binlength) string(LENGTH ${infile} _infileLength) set(_checkinfile ${CMAKE_CURRENT_SOURCE_DIR}) @@ -65,7 +65,7 @@ macro(QT5_MAKE_OUTPUT_FILE infile prefix ext outfile ) endmacro() -macro(QT5_GET_MOC_FLAGS _moc_flags) +macro(qt5_get_moc_flags _moc_flags) set(${_moc_flags}) get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES) @@ -97,7 +97,7 @@ endmacro() # helper macro to set up a moc rule -function(QT5_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target moc_depends) +function(qt5_create_moc_command infile outfile moc_flags moc_options moc_target moc_depends) # Pass the parameters in a file. Set the working directory to # be that containing the parameters file and reference it by # just the file name. This is necessary because the moc tool on @@ -143,7 +143,7 @@ function(QT5_CREATE_MOC_COMMAND infile outfile moc_flags moc_options moc_target endfunction() -function(QT5_GENERATE_MOC infile outfile ) +function(qt5_generate_moc infile outfile ) # get include dirs and flags qt5_get_moc_flags(moc_flags) get_filename_component(abs_infile ${infile} ABSOLUTE) @@ -160,7 +160,7 @@ endfunction() # qt5_wrap_cpp(outfiles inputfile ... ) -function(QT5_WRAP_CPP outfiles ) +function(qt5_wrap_cpp outfiles ) # get include dirs qt5_get_moc_flags(moc_flags) @@ -189,7 +189,7 @@ endfunction() # _qt5_parse_qrc_file(infile _out_depends _rc_depends) # internal -function(_QT5_PARSE_QRC_FILE infile _out_depends _rc_depends) +function(_qt5_parse_qrc_file infile _out_depends _rc_depends) get_filename_component(rc_path ${infile} PATH) if(EXISTS "${infile}") @@ -222,7 +222,7 @@ endfunction() # qt5_add_binary_resources(target inputfiles ... ) -function(QT5_ADD_BINARY_RESOURCES target ) +function(qt5_add_binary_resources target ) set(options) set(oneValueArgs DESTINATION) @@ -241,7 +241,7 @@ function(QT5_ADD_BINARY_RESOURCES target ) foreach(it ${rcc_files}) get_filename_component(infile ${it} ABSOLUTE) - _QT5_PARSE_QRC_FILE(${infile} _out_depends _rc_depends) + _qt5_parse_qrc_file(${infile} _out_depends _rc_depends) set_source_files_properties(${infile} PROPERTIES SKIP_AUTORCC ON) set(infiles ${infiles} ${infile}) set(out_depends ${out_depends} ${_out_depends}) @@ -258,7 +258,7 @@ endfunction() # qt5_add_resources(outfiles inputfile ... ) -function(QT5_ADD_RESOURCES outfiles ) +function(qt5_add_resources outfiles ) set(options) set(oneValueArgs) @@ -278,7 +278,7 @@ function(QT5_ADD_RESOURCES outfiles ) get_filename_component(infile ${it} ABSOLUTE) set(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.cpp) - _QT5_PARSE_QRC_FILE(${infile} _out_depends _rc_depends) + _qt5_parse_qrc_file(${infile} _out_depends _rc_depends) set_source_files_properties(${infile} PROPERTIES SKIP_AUTORCC ON) add_custom_command(OUTPUT ${outfile} @@ -295,7 +295,7 @@ endfunction() # qt5_add_big_resources(outfiles inputfile ... ) -function(QT5_ADD_BIG_RESOURCES outfiles ) +function(qt5_add_big_resources outfiles ) if (CMAKE_VERSION VERSION_LESS 3.9) message(FATAL_ERROR, "qt5_add_big_resources requires CMake 3.9 or newer") endif() @@ -319,7 +319,7 @@ function(QT5_ADD_BIG_RESOURCES outfiles ) set(tmpoutfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}tmp.cpp) set(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.o) - _QT5_PARSE_QRC_FILE(${infile} _out_depends _rc_depends) + _qt5_parse_qrc_file(${infile} _out_depends _rc_depends) set_source_files_properties(${infile} PROPERTIES SKIP_AUTORCC ON) add_custom_command(OUTPUT ${tmpoutfile} COMMAND ${Qt5Core_RCC_EXECUTABLE} ${rcc_options} --name ${outfilename} --pass 1 --output ${tmpoutfile} ${infile} @@ -343,58 +343,53 @@ endfunction() set(_Qt5_COMPONENT_PATH "${CMAKE_CURRENT_LIST_DIR}/..") -if (NOT CMAKE_VERSION VERSION_LESS 2.8.9) - macro(qt5_use_modules _target _link_type) - if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.11) - if(CMAKE_WARN_DEPRECATED) - set(messageType WARNING) - endif() - if(CMAKE_ERROR_DEPRECATED) - set(messageType FATAL_ERROR) - endif() - if(messageType) - message(${messageType} "The qt5_use_modules macro is obsolete. Use target_link_libraries with IMPORTED targets instead.") - endif() - endif() +macro(qt5_use_modules _target _link_type) + if(CMAKE_WARN_DEPRECATED) + set(messageType WARNING) + endif() + if(CMAKE_ERROR_DEPRECATED) + set(messageType FATAL_ERROR) + endif() + if(messageType) + message(${messageType} "The qt5_use_modules macro is obsolete. Use target_link_libraries with IMPORTED targets instead.") + endif() - if (NOT TARGET ${_target}) - message(FATAL_ERROR "The first argument to qt5_use_modules must be an existing target.") - endif() - if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE" ) - set(_qt5_modules ${ARGN}) - set(_qt5_link_type ${_link_type}) - else() - set(_qt5_modules ${_link_type} ${ARGN}) - endif() + if (NOT TARGET ${_target}) + message(FATAL_ERROR "The first argument to qt5_use_modules must be an existing target.") + endif() + if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE" ) + set(_qt5_modules ${ARGN}) + set(_qt5_link_type ${_link_type}) + else() + set(_qt5_modules ${_link_type} ${ARGN}) + endif() - if ("${_qt5_modules}" STREQUAL "") - message(FATAL_ERROR "qt5_use_modules requires at least one Qt module to use.") - endif() + if ("${_qt5_modules}" STREQUAL "") + message(FATAL_ERROR "qt5_use_modules requires at least one Qt module to use.") + endif() - foreach(_module ${_qt5_modules}) + foreach(_module ${_qt5_modules}) + if (NOT Qt5${_module}_FOUND) + find_package(Qt5${_module} PATHS "${_Qt5_COMPONENT_PATH}" NO_DEFAULT_PATH) if (NOT Qt5${_module}_FOUND) - find_package(Qt5${_module} PATHS "${_Qt5_COMPONENT_PATH}" NO_DEFAULT_PATH) - if (NOT Qt5${_module}_FOUND) - message(FATAL_ERROR "Cannot use \"${_module}\" module which has not yet been found.") - endif() - endif() - target_link_libraries(${_target} ${_qt5_link_type} ${Qt5${_module}_LIBRARIES}) - set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt5${_module}_INCLUDE_DIRS}) - set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_module}_COMPILE_DEFINITIONS}) - set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG) - set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG) - set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG) - if (Qt5_POSITION_INDEPENDENT_CODE - AND (CMAKE_VERSION VERSION_LESS 2.8.12 - AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" - OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))) - set_property(TARGET ${_target} PROPERTY POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE}) + message(FATAL_ERROR "Cannot use \"${_module}\" module which has not yet been found.") endif() - endforeach() - endmacro() -endif() + endif() + target_link_libraries(${_target} ${_qt5_link_type} ${Qt5${_module}_LIBRARIES}) + set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt5${_module}_INCLUDE_DIRS}) + set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_module}_COMPILE_DEFINITIONS}) + set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG) + set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG) + set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG) + if (Qt5_POSITION_INDEPENDENT_CODE + AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)) + set_property(TARGET ${_target} PROPERTY POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE}) + endif() + endforeach() +endmacro() -function(QT5_IMPORT_PLUGINS TARGET_NAME) +function(qt5_import_plugins TARGET_NAME) set(_doing "") foreach(_arg ${ARGN}) if(_arg STREQUAL "INCLUDE") |