Added CACHE option to tde_execute_process and clean up build output

This partially closes Bug 882
Thanks to Aleksey Midenkov for the patch!
pull/1/head
Timothy Pearson 12 years ago
parent 6b3a1fc54f
commit ea715e15ed

@ -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 )

@ -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}

@ -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" )

@ -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 )

Loading…
Cancel
Save