Warning, /libraries/kreport/cmake/modules/KReportQueryQmake.cmake is written in an unsupported language. File is not indexed.
0001 # Copied from ECM 5.28.0, ECMQueryQmake.cmake
0002
0003 # Redistribution and use in source and binary forms, with or without
0004 # modification, are permitted provided that the following conditions
0005 # are met:
0006 #
0007 # 1. Redistributions of source code must retain the copyright
0008 # notice, this list of conditions and the following disclaimer.
0009 # 2. Redistributions in binary form must reproduce the copyright
0010 # notice, this list of conditions and the following disclaimer in the
0011 # documentation and/or other materials provided with the distribution.
0012 # 3. The name of the author may not be used to endorse or promote products
0013 # derived from this software without specific prior written permission.
0014 #
0015 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
0016 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0017 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
0018 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
0019 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
0020 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0021 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0022 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0023 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
0024 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0025
0026 find_package(Qt5Core QUIET)
0027
0028 if (Qt5Core_FOUND)
0029 set(_qmake_executable_default "qmake-qt5")
0030 endif ()
0031 if (TARGET Qt5::qmake)
0032 get_target_property(_qmake_executable_default Qt5::qmake LOCATION)
0033 endif()
0034 set(QMAKE_EXECUTABLE ${_qmake_executable_default}
0035 CACHE FILEPATH "Location of the Qt5 qmake executable")
0036
0037 # This is not public API (yet)!
0038 function(query_qmake result_variable qt_variable)
0039 if(NOT QMAKE_EXECUTABLE)
0040 set(${result_variable} "" PARENT_SCOPE)
0041 message(WARNING "Should specify a qmake Qt5 binary. Can't check ${qt_variable}")
0042 return()
0043 endif()
0044 execute_process(
0045 COMMAND ${QMAKE_EXECUTABLE} -query "${qt_variable}"
0046 RESULT_VARIABLE return_code
0047 OUTPUT_VARIABLE output
0048 )
0049 if(return_code EQUAL 0)
0050 string(STRIP "${output}" output)
0051 file(TO_CMAKE_PATH "${output}" output_path)
0052 set(${result_variable} "${output_path}" PARENT_SCOPE)
0053 else()
0054 message(WARNING "Failed call: ${QMAKE_EXECUTABLE} -query \"${qt_variable}\"")
0055 message(FATAL_ERROR "QMake call failed: ${return_code}")
0056 endif()
0057 endfunction()