summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-03-05 23:27:31 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-03-05 23:27:31 -0600
commitea715e15edb3f6b9e78d631d75e18bb9dbace497 (patch)
tree737eb56c7e410db3dfc5abd7db7fdc22594ea6f1 /modules
parent6b3a1fc54f258941ae7ae10909a23d32afee9df7 (diff)
downloadtde-cmake-ea715e15edb3f6b9e78d631d75e18bb9dbace497.tar.gz
tde-cmake-ea715e15edb3f6b9e78d631d75e18bb9dbace497.zip
Added CACHE option to tde_execute_process and clean up build output
This partially closes Bug 882 Thanks to Aleksey Midenkov for the patch!
Diffstat (limited to 'modules')
-rw-r--r--modules/FindTQt.cmake32
-rw-r--r--modules/TDEMacros.cmake26
-rw-r--r--modules/TDESetupPaths.cmake1
-rw-r--r--modules/tde_uic.cmake4
4 files changed, 46 insertions, 17 deletions
diff --git a/modules/FindTQt.cmake b/modules/FindTQt.cmake
index e354973..bf2ca8a 100644
--- a/modules/FindTQt.cmake
+++ b/modules/FindTQt.cmake
@@ -24,36 +24,46 @@ tde_execute_process(
COMMAND pkg-config tqt --variable=tmoc_executable
OUTPUT_VARIABLE TMOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )
-if( TMOC_EXECUTABLE )
- tqt_message( " tmoc path: ${TMOC_EXECUTABLE}" )
-else( )
- tde_message_fatal( "Path to tmoc is not set.\n tqt is correctly installed?" )
+if( NOT EXISTS ${TMOC_EXECUTABLE} )
+ tde_message_fatal( "tmoc is not found!\n tqt is correctly installed?" )
endif( )
+tqt_message( " tmoc path: ${TMOC_EXECUTABLE}" )
+
# moc_executable
tde_execute_process(
COMMAND pkg-config tqt --variable=moc_executable
OUTPUT_VARIABLE MOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )
-if( MOC_EXECUTABLE )
- tqt_message( " moc path: ${MOC_EXECUTABLE}" )
-else( )
+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}" )
+
# uic_executable
tde_execute_process(
COMMAND pkg-config tqt --variable=uic_executable
OUTPUT_VARIABLE UIC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )
-if( UIC_EXECUTABLE )
- tqt_message( " uic path: ${UIC_EXECUTABLE}" )
-else( )
- tde_message_fatal( "Path to uic is not set.\n tqt is correctly installed?" )
+if( NOT EXISTS ${UIC_EXECUTABLE} )
+ tde_message_fatal( "uic not found!\n tqt is correctly installed?" )
+endif( )
+
+tqt_message( " uic path: ${UIC_EXECUTABLE}" )
+
+
+# tqt-replace script
+set( TQT_REPLACE_SCRIPT "${TQT_PREFIX}/bin/tqt-replace" )
+
+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}" )
+
# check if tqt is usable
tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index a710f43..0cc3bc4 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -42,9 +42,7 @@ macro( tde_get_arg ARG_NAME COUNT RETURN REST )
list( APPEND ${REST} ${ARGN} )
list( FIND ${REST} ${ARG_NAME} _arg_idx)
if( NOT ${_arg_idx} EQUAL -1 )
- list( APPEND ${REST} ___ensure_list___ )
list( REMOVE_AT ${REST} ${_arg_idx} )
- list( REMOVE_ITEM ${REST} ___ensure_list___ )
set( _i 0 )
while( ${_i} LESS ${COUNT} )
list( GET ${REST} ${_arg_idx} _arg )
@@ -66,19 +64,38 @@ macro( tde_execute_process )
tde_get_arg( MESSAGE 1 _message _rest_args ${ARGV} )
tde_get_arg( RESULT_VARIABLE 1 _result_variable _tmp ${_rest_args} )
tde_get_arg( COMMAND 1 _command _tmp ${_rest_args} )
+ tde_get_arg( OUTPUT_VARIABLE 1 _output_variable _tmp ${_rest_args} )
+ tde_get_arg( CACHE 3 _cache _rest_args2 ${_rest_args} )
+
+ # handle optional FORCE parameter
+ if( DEFINED _cache )
+ list( GET _cache 2 _tmp )
+ if( _tmp STREQUAL FORCE )
+ set( _rest_args ${_rest_args2} )
+ else()
+ tde_get_arg( CACHE 2 _cache _rest_args ${_rest_args} )
+ endif()
+ endif()
+
if( NOT DEFINED _result_variable )
list( APPEND _rest_args RESULT_VARIABLE _exec_result )
set( _result_variable _exec_result )
endif()
+
execute_process( ${_rest_args} )
+
+ if( DEFINED _output_variable AND DEFINED _cache )
+ set( ${_output_variable} ${${_output_variable}} CACHE ${_cache} )
+ endif()
+
if( ${_result_variable} )
if( DEFINED _message )
- message( FATAL_ERROR ${_message} )
+ tde_message_fatal( ${_message} )
else()
if( ${${_result_variable}} MATCHES "^[0-9]+$" )
set( ${_result_variable} "status ${${_result_variable}} returned!" )
endif()
- message( FATAL_ERROR "Error executing '${_command}': ${${_result_variable}}" )
+ tde_message_fatal( "Error executing '${_command}': ${${_result_variable}}" )
endif()
endif()
endmacro( tde_execute_process )
@@ -268,6 +285,7 @@ macro( tde_add_ui_files _sources )
add_custom_command( OUTPUT ${_ui_basename}.h ${_ui_basename}.cpp
COMMAND ${CMAKE_COMMAND}
-DUIC_EXECUTABLE:FILEPATH=${UIC_EXECUTABLE}
+ -DTQT_REPLACE_SCRIPT:FILEPATH=${TQT_REPLACE_SCRIPT}
-DTDE_QTPLUGINS_DIR:FILEPATH=${TDE_QTPLUGINS_DIR}
-DUI_FILE:FILEPATH=${_ui_absolute_path}
-DMASTER_SOURCE_DIR:FILEPATH=${CMAKE_SOURCE_DIR}
diff --git a/modules/TDESetupPaths.cmake b/modules/TDESetupPaths.cmake
index 1e0dbaf..02a0954 100644
--- a/modules/TDESetupPaths.cmake
+++ b/modules/TDESetupPaths.cmake
@@ -35,6 +35,7 @@ macro( tde_setup_paths )
_tde_internal_setup_path( SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)" )
_tde_internal_setup_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})" )
_tde_internal_setup_path( LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/trinity/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/trinity/libexec)" )
+ _tde_internal_setup_path( PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" "The install dir for pkg-config metadata files" )
_tde_internal_setup_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix" )
_tde_internal_setup_path( CMAKE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/cmake" "The install dir for cmake import modules" )
diff --git a/modules/tde_uic.cmake b/modules/tde_uic.cmake
index e4c438b..fcd16f1 100644
--- a/modules/tde_uic.cmake
+++ b/modules/tde_uic.cmake
@@ -17,12 +17,12 @@ get_filename_component( _ui_basename ${UI_FILE} NAME_WE )
# FIXME this will working only on out-of-source mode
set( local_ui_file ${_ui_basename}.ui )
configure_file( ${UI_FILE} ${local_ui_file} COPYONLY )
-tde_execute_process( COMMAND tqt-replace ${local_ui_file} )
+tde_execute_process( COMMAND ${TQT_REPLACE_SCRIPT} ${local_ui_file} )
# ui.h extension file, if exists
if( EXISTS "${UI_FILE}.h" )
configure_file( ${UI_FILE}.h ${local_ui_file}.h COPYONLY )
- tde_execute_process( COMMAND tqt-replace ${local_ui_file}.h )
+ tde_execute_process( COMMAND ${TQT_REPLACE_SCRIPT} ${local_ui_file}.h )
endif( )
if( TDE_QTPLUGINS_DIR )