Fix vague build errors due to blind execution in CMake

This closes Bug 874
Thanks to Aleksey Midenkov for the patch!
pull/1/head
Timothy Pearson 13 years ago
parent 8e6f203f92
commit 975cc10f8b

@ -25,14 +25,12 @@ if( NOT TDE_FOUND )
endif( NOT DEFINED KDECONFIG_EXECUTABLE )
# check for installed trinity version
execute_process(
tde_execute_process(
COMMAND ${KDECONFIG_EXECUTABLE} --version
OUTPUT_VARIABLE _version
RESULT_VARIABLE _result
OUTPUT_STRIP_TRAILING_WHITESPACE )
if( _result )
tde_message_fatal( "Unable to run kde-config!\n TDELIBS are correctly installed?\n Path to kde-config are corect?" )
endif( _result )
OUTPUT_STRIP_TRAILING_WHITESPACE
MESSAGE "Unable to run kde-config!\n TDELIBS are correctly installed?\n Path to kde-config are corect?" )
# parse kde-config output, to extract TDE version
string( REGEX MATCH "TDE: ([0-9\\.]+)" __dummy "${_version}" )
@ -40,7 +38,7 @@ if( NOT TDE_FOUND )
# ask kde-config for few paths
macro( __internal_get_path __type __var )
execute_process(
tde_execute_process(
COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install ${__type}
OUTPUT_VARIABLE ${__var}
OUTPUT_STRIP_TRAILING_WHITESPACE )

@ -20,7 +20,7 @@ if( NOT TQT_FOUND )
endif( )
# tmoc_executable
execute_process(
tde_execute_process(
COMMAND pkg-config tqt --variable=tmoc_executable
OUTPUT_VARIABLE TMOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )
@ -32,7 +32,7 @@ endif( )
# moc_executable
execute_process(
tde_execute_process(
COMMAND pkg-config tqt --variable=moc_executable
OUTPUT_VARIABLE MOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )
@ -44,7 +44,7 @@ endif( )
# uic_executable
execute_process(
tde_execute_process(
COMMAND pkg-config tqt --variable=uic_executable
OUTPUT_VARIABLE UIC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )

@ -29,38 +29,76 @@ endmacro( tde_message_fatal )
#################################################
#####
##### tde_get_arg( <ARG_NAME> <COUNT> <RETURN> <REST> <ARGS...> )
##### ARG_NAME(string): name of an argument to find in ARGS
##### COUNT(number): argument dimension, a number of items returned in RETURN
##### RETURN(list ref): items returned for argument as they found in ARGS
##### REST(list ref): rest of items except argument name and items returned in RETURN
##### ARGS(list): source list of arguments
macro( tde_get_arg ARG_NAME COUNT RETURN REST )
unset( ${RETURN} )
unset( ${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 )
list( REMOVE_AT ${REST} ${_arg_idx} )
list( APPEND ${RETURN} ${_arg} )
math( EXPR _i "${_i} + 1" )
endwhile()
endif()
endmacro( tde_get_arg )
################################################
#####
##### tde_execute_process( <ARGS...> [MESSAGE <MSG>] )
##### MSG: fatal error message (standard message will be written if not supplied)
##### ARGS: execute_process arguments
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} )
if( NOT DEFINED _result_variable )
list( APPEND _rest_args RESULT_VARIABLE _exec_result )
set( _result_variable _exec_result )
endif()
execute_process( ${_rest_args} )
if( ${_result_variable} )
if( DEFINED _message )
message( FATAL_ERROR ${_message} )
else()
if( ${${_result_variable}} MATCHES "^[0-9]+$" )
set( ${_result_variable} "status ${${_result_variable}} returned!" )
endif()
message( FATAL_ERROR "Error executing '${_command}': ${${_result_variable}}" )
endif()
endif()
endmacro( tde_execute_process )
if( DEFINED MASTER_SOURCE_DIR )
return( )
endif( )
########### slave part ends here ###############
################################################
#####
##### tde_install_icons( <icons...> THEME <svgicons> DESTINATION <destdir> )
##### default theme: hicolor
##### default destination: ${SHARE_INSTALL_DIR}/icons
macro( tde_install_icons )
# clearing
unset( _dest )
unset( _req_theme )
unset( _icons )
set( _var _icons )
# parse all arguments
foreach( _arg ${ARGV} )
# directive DESTINATION
if( _arg STREQUAL "DESTINATION" )
set( _var _dest )
set( _directive 1 )
endif( _arg STREQUAL "DESTINATION" )
# directive THEME
if( _arg STREQUAL "THEME" )
set( _var _req_theme )
set( _directive 1 )
endif( _arg STREQUAL "THEME" )
# collect data
if( _directive )
unset( _directive )
else( _directive )
set( ${_var} ${${_var}} ${_arg} )
set( _var _icons )
endif( _directive )
endforeach( _arg )
tde_get_arg( DESTINATION 1 _dest _args ${ARGV} )
tde_get_arg( THEME 1 _req_theme _icons ${_args} )
#defaults
if( NOT _icons )
@ -232,6 +270,8 @@ macro( tde_add_ui_files _sources )
-DUIC_EXECUTABLE:FILEPATH=${UIC_EXECUTABLE}
-DTDE_QTPLUGINS_DIR:FILEPATH=${TDE_QTPLUGINS_DIR}
-DUI_FILE:FILEPATH=${_ui_absolute_path}
-DMASTER_SOURCE_DIR:FILEPATH=${CMAKE_SOURCE_DIR}
-DMASTER_BINARY_DIR:FILEPATH=${CMAKE_BINARY_DIR}
-P ${CMAKE_MODULE_PATH}/tde_uic.cmake
COMMAND ${MOC_EXECUTABLE} ${_ui_basename}.h >> ${_ui_basename}.cpp
DEPENDS ${_ui_absolute_path} )
@ -702,7 +742,7 @@ endmacro( tde_add_kpart )
#####
##### tde_curdatetime
macro( tde_curdatetime result )
execute_process( COMMAND "date" "+%m/%d/%Y %H:%M:%S" OUTPUT_VARIABLE ${result} )
tde_execute_process( COMMAND "date" "+%m/%d/%Y %H:%M:%S" OUTPUT_VARIABLE ${result} )
string( REGEX REPLACE "(..)/(..)/(....) (........).*" "\\1/\\2/\\3 \\4" ${result} ${${result}} )
endmacro( tde_curdatetime )

@ -9,24 +9,27 @@
#
#################################################
set( CMAKE_MODULE_PATH "${MASTER_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )
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 )
execute_process( COMMAND tqt-replace ${local_ui_file} )
tde_execute_process( COMMAND tqt-replace ${local_ui_file} )
# ui.h extension file, if exists
if( EXISTS "${UI_FILE}.h" )
configure_file( ${UI_FILE}.h ${local_ui_file}.h COPYONLY )
execute_process( COMMAND tqt-replace ${local_ui_file}.h )
tde_execute_process( COMMAND tqt-replace ${local_ui_file}.h )
endif( )
if( TDE_QTPLUGINS_DIR )
set( L -L ${TDE_QTPLUGINS_DIR} )
endif( )
execute_process( COMMAND ${UIC_EXECUTABLE}
tde_execute_process( COMMAND ${UIC_EXECUTABLE}
-nounload -tr tr2i18n
${L}
${local_ui_file}
@ -42,7 +45,7 @@ if( _ui_h_content )
file( WRITE ${_ui_basename}.h "${_ui_h_content}" )
endif( )
execute_process( COMMAND ${UIC_EXECUTABLE}
tde_execute_process( COMMAND ${UIC_EXECUTABLE}
-nounload -tr tr2i18n
${L}
-impl ${_ui_basename}.h

Loading…
Cancel
Save