summaryrefslogtreecommitdiffstats
path: root/modules/FindTQt.cmake
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-05-10 12:43:42 +0200
committerSlávek Banko <slavek.banko@axis.cz>2020-05-11 00:42:15 +0200
commit778522d10450a8a45133c65ae0175224c6abc700 (patch)
treee3ed06dd939195c5c60bd7f5a66adc51a3b9cad3 /modules/FindTQt.cmake
parent4ced9fd928bfdf8a44152492b504bba4e0f98da5 (diff)
downloadtde-cmake-778522d10450a8a45133c65ae0175224c6abc700.tar.gz
tde-cmake-778522d10450a8a45133c65ae0175224c6abc700.zip
Add caching of variables from checks results and add conditions
to avoid unnecessary repetition of checks. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'modules/FindTQt.cmake')
-rw-r--r--modules/FindTQt.cmake123
1 files changed, 64 insertions, 59 deletions
diff --git a/modules/FindTQt.cmake b/modules/FindTQt.cmake
index 6194bb2..9c36cb9 100644
--- a/modules/FindTQt.cmake
+++ b/modules/FindTQt.cmake
@@ -13,94 +13,99 @@ macro( tqt_message )
message( STATUS "${ARGN}" )
endmacro( )
-pkg_search_module( TQT tqt )
-
if( NOT TQT_FOUND )
- tde_message_fatal( "Unable to find tqt!\n Try adding the directory in which the tqt.pc file is located\nto the PKG_CONFIG_PATH variable." )
-endif( )
+ pkg_search_module( TQT tqt )
+
+ if( NOT TQT_FOUND )
+ tde_message_fatal( "Unable to find tqt!\n Try adding the directory in which the tqt.pc file is located\nto the PKG_CONFIG_PATH variable." )
+ endif( )
-mark_as_advanced(
+ mark_as_advanced(
TMOC_EXECUTABLE
MOC_EXECUTABLE
UIC_EXECUTABLE
-)
+ )
-# tmoc_executable
-tde_execute_process(
- COMMAND pkg-config tqt --variable=tmoc_executable
- OUTPUT_VARIABLE TMOC_EXECUTABLE
- CACHE FILEPATH "TQt tmoc executable path"
- OUTPUT_STRIP_TRAILING_WHITESPACE )
+ # tmoc_executable
+ tde_execute_process(
+ COMMAND pkg-config tqt --variable=tmoc_executable
+ OUTPUT_VARIABLE TMOC_EXECUTABLE
+ CACHE FILEPATH "TQt tmoc executable path"
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
-if( NOT EXISTS ${TMOC_EXECUTABLE} )
- tde_message_fatal( "tmoc is not found!\n tqt is correctly installed?" )
-endif( )
+ if( NOT EXISTS ${TMOC_EXECUTABLE} )
+ tde_message_fatal( "tmoc is not found!\n tqt is correctly installed?" )
+ endif( )
-tqt_message( " tmoc path: ${TMOC_EXECUTABLE}" )
+ tqt_message( " tmoc path: ${TMOC_EXECUTABLE}" )
-# moc_executable
-tde_execute_process(
- COMMAND pkg-config tqt --variable=moc_executable
- OUTPUT_VARIABLE MOC_EXECUTABLE
- CACHE FILEPATH "TQt moc executable path"
- OUTPUT_STRIP_TRAILING_WHITESPACE )
+ # moc_executable
+ tde_execute_process(
+ COMMAND pkg-config tqt --variable=moc_executable
+ OUTPUT_VARIABLE MOC_EXECUTABLE
+ CACHE FILEPATH "TQt moc executable path"
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
-if( NOT EXISTS ${MOC_EXECUTABLE} )
- tde_message_fatal( "Path to moc is not set.\n tqt is correctly installed?" )
-endif( )
+ if( NOT EXISTS ${MOC_EXECUTABLE} )
+ tde_message_fatal( "Path to moc is not set.\n tqt is correctly installed?" )
+ endif( )
-tqt_message( " moc path: ${MOC_EXECUTABLE}" )
+ tqt_message( " moc path: ${MOC_EXECUTABLE}" )
-# uic_executable
-tde_execute_process(
- COMMAND pkg-config tqt --variable=uic_executable
- OUTPUT_VARIABLE UIC_EXECUTABLE
- CACHE FILEPATH "TQt uic executable path"
- OUTPUT_STRIP_TRAILING_WHITESPACE )
+ # uic_executable
+ tde_execute_process(
+ COMMAND pkg-config tqt --variable=uic_executable
+ OUTPUT_VARIABLE UIC_EXECUTABLE
+ CACHE FILEPATH "TQt uic executable path"
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
-if( NOT EXISTS ${UIC_EXECUTABLE} )
- tde_message_fatal( "uic not found!\n tqt is correctly installed?" )
-endif( )
+ if( NOT EXISTS ${UIC_EXECUTABLE} )
+ tde_message_fatal( "uic not found!\n tqt is correctly installed?" )
+ endif( )
-tqt_message( " uic path: ${UIC_EXECUTABLE}" )
+ tqt_message( " uic path: ${UIC_EXECUTABLE}" )
-# tqt-replace script
-set( TQT_REPLACE_SCRIPT "${TQT_PREFIX}/bin/tqt-replace" )
+ # tqt-replace script
+ set( TQT_REPLACE_SCRIPT "${TQT_PREFIX}/bin/tqt-replace"
+ CACHE FILEPATH "TQt replace script path" )
-if( NOT EXISTS ${TQT_REPLACE_SCRIPT} )
- tde_message_fatal( "tqt-replace not found!\n Check tqt installation." )
-endif( )
+ if( NOT EXISTS ${TQT_REPLACE_SCRIPT} )
+ tde_message_fatal( "tqt-replace not found!\n Check tqt installation." )
+ endif( )
-tqt_message( " tqt-replace path: ${TQT_REPLACE_SCRIPT}" )
+ tqt_message( " tqt-replace path: ${TQT_REPLACE_SCRIPT}" )
-# check if tqt is usable
-tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
-set( CMAKE_REQUIRED_INCLUDES ${TQT_INCLUDE_DIRS} )
-foreach( _dirs ${TQT_LIBRARY_DIRS} )
- list( APPEND CMAKE_REQUIRED_LIBRARIES "-L${_dirs}" )
-endforeach()
-list( APPEND CMAKE_REQUIRED_LIBRARIES ${TQT_LIBRARIES} )
+ # check if tqt is usable
+ tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
+ set( CMAKE_REQUIRED_INCLUDES ${TQT_INCLUDE_DIRS} )
+ foreach( _dirs ${TQT_LIBRARY_DIRS} )
+ list( APPEND CMAKE_REQUIRED_LIBRARIES "-L${_dirs}" )
+ endforeach()
+ list( APPEND CMAKE_REQUIRED_LIBRARIES ${TQT_LIBRARIES} )
-check_cxx_source_compiles("
+ check_cxx_source_compiles("
#include <tqapplication.h>
int main(int argc, char **argv) { TQApplication app(argc, argv); return 0; } "
- HAVE_USABLE_TQT )
+ HAVE_USABLE_TQT )
+
+ if( NOT HAVE_USABLE_TQT )
+ tde_message_fatal( "Unable to build a simple tqt test." )
+ endif( )
-if( NOT HAVE_USABLE_TQT )
- tde_message_fatal( "Unable to build a simple tqt test." )
-endif( )
+ tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
-tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
+ # TQT_CXX_FLAGS
+ foreach( _flag ${TQT_CFLAGS} ${TQT_CFLAGS_OTHER} )
+ set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS} ${_flag}" )
+ endforeach()
+ set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS}" CACHE INTERNAL "" )
-# TQT_CXX_FLAGS
-foreach( _flag ${TQT_CFLAGS} ${TQT_CFLAGS_OTHER} )
- set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS} ${_flag}" )
-endforeach()
+endif( NOT TQT_FOUND )
# Set compiler flags according to build type
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG" )