Replace the remaining KDE3 macros.

+ Targets are created to generate files, not just commands.
+ Generating kidl files is created as a separate targets.
+ Headers are added to the list of generated files.
+ This allows for more accurate dependency determination.
+ This prevents files generation from being repeated.
+ This prevents the occasional FTBFS during a parallel build.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/40/head
Slávek Banko 5 years ago
parent e8a95f169e
commit 5cd16d6fb9
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -15,7 +15,6 @@
# #
################################################# #################################################
include( KDE3Macros ) # we will need this module for a while
include( CheckCXXCompilerFlag ) include( CheckCXXCompilerFlag )
@ -474,6 +473,144 @@ macro( tde_automoc )
endmacro( tde_automoc ) endmacro( tde_automoc )
#################################################
#####
##### tde_create_dcop_kidl
macro( tde_create_dcop_kidl _kidl _kidl_source )
get_filename_component( _kidl_source ${_kidl_source} ABSOLUTE )
get_filename_component( _kidl_basename ${_kidl_source} NAME_WE )
set( _kidl_output ${CMAKE_CURRENT_BINARY_DIR}/${_kidl_basename}.kidl )
file( RELATIVE_PATH _kidl_target "${CMAKE_BINARY_DIR}" "${_kidl_output}" )
string( REPLACE "/" "+" _kidl_target "${_kidl_target}" )
if( NOT TARGET ${_kidl_target} )
add_custom_command(
OUTPUT ${_kidl_output}
COMMAND ${KDE3_DCOPIDL_EXECUTABLE}
ARGS ${_kidl_source} > ${_kidl_output}
DEPENDS ${_kidl_source}
)
add_custom_target( ${_kidl_target} DEPENDS ${_kidl_output} )
if( NOT TDE_FOUND )
add_dependencies( ${_kidl_target} dcopidl )
endif( )
endif( )
set( ${_kidl} ${_kidl_output} )
endmacro( tde_create_dcop_kidl )
#################################################
#####
##### tde_add_dcop_skels
macro( tde_add_dcop_skels _sources )
foreach( _current_FILE ${ARGN} )
get_filename_component( _tmp_FILE ${_current_FILE} ABSOLUTE )
get_filename_component( _basename ${_tmp_FILE} NAME_WE )
set( _skel ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_skel.cpp )
file( RELATIVE_PATH _skel_target "${CMAKE_BINARY_DIR}" "${_skel}" )
string( REPLACE "/" "+" _skel_target "${_skel_target}" )
tde_create_dcop_kidl( _kidl ${_tmp_FILE} )
if( NOT TARGET ${_skel_target} )
add_custom_command(
OUTPUT ${_skel}
COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE}
ARGS --c++-suffix cpp --no-signals --no-stub ${_kidl}
DEPENDS ${_kidl_target}
)
add_custom_target( ${_skel_target} DEPENDS ${_skel} )
if( NOT TDE_FOUND )
add_dependencies( ${_skel_target} dcopidl2cpp )
endif( )
endif( )
list( APPEND ${_sources} ${_skel} )
endforeach( _current_FILE )
endmacro( tde_add_dcop_skels )
#################################################
#####
##### tde_add_dcop_stubs
macro( tde_add_dcop_stubs _sources )
foreach( _current_FILE ${ARGN} )
get_filename_component( _tmp_FILE ${_current_FILE} ABSOLUTE )
get_filename_component( _basename ${_tmp_FILE} NAME_WE )
set( _stub_CPP ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.cpp )
set( _stub_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${_basename}_stub.h )
file( RELATIVE_PATH _stub_target "${CMAKE_BINARY_DIR}" "${_stub_CPP}" )
string( REPLACE "/" "+" _stub_target "${_stub_target}" )
tde_create_dcop_kidl( _kidl ${_tmp_FILE} )
if( NOT TARGET ${_stub_target} )
add_custom_command(
OUTPUT ${_stub_CPP} ${_stub_HEADER}
COMMAND ${KDE3_DCOPIDL2CPP_EXECUTABLE}
ARGS --c++-suffix cpp --no-signals --no-skel ${_kidl}
DEPENDS ${_kidl_target}
)
add_custom_target( ${_stub_target} DEPENDS ${_stub_CPP} ${_stub_HEADER} )
if( NOT TDE_FOUND )
add_dependencies( ${_stub_target} dcopidl2cpp )
endif( )
endif( )
list( APPEND ${_sources} ${_stub_CPP} )
endforeach( _current_FILE )
endmacro( tde_add_dcop_stubs )
#################################################
#####
##### tde_add_kcfg_files
macro( tde_add_kcfg_files _sources )
foreach( _current_FILE ${ARGN} )
get_filename_component( _tmp_FILE ${_current_FILE} ABSOLUTE )
get_filename_component( _basename ${_tmp_FILE} NAME_WE )
file( READ ${_tmp_FILE} _contents )
string( REGEX REPLACE "^(.*\n)?File=([^\n]+)\n.*$" "\\2" _kcfg_FILE "${_contents}" )
set( _src_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp )
set( _header_FILE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h )
file( RELATIVE_PATH _kcfg_target "${CMAKE_BINARY_DIR}" "${_src_FILE}" )
string( REPLACE "/" "+" _kcfg_target "${_kcfg_target}" )
if( NOT TARGET ${_kcfg_target} )
add_custom_command(
OUTPUT ${_src_FILE} ${_header_FILE}
COMMAND ${KDE3_KCFGC_EXECUTABLE}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE} ${_tmp_FILE}
DEPENDS ${_tmp_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_kcfg_FILE}
)
add_custom_target( ${_kcfg_target} DEPENDS ${_src_FILE} ${_header_FILE} )
if( NOT TDE_FOUND )
add_dependencies( ${_kcfg_target} tdeconfig_compiler )
endif( )
endif( )
list( APPEND ${_sources} ${_src_FILE} )
endforeach( _current_FILE )
endmacro( tde_add_kcfg_files )
################################################# #################################################
##### #####
##### __tde_internal_process_sources ##### __tde_internal_process_sources
@ -498,15 +635,15 @@ macro( __tde_internal_process_sources _sources )
# handle .skel files # handle .skel files
elseif( ${_ext} STREQUAL ".skel" ) elseif( ${_ext} STREQUAL ".skel" )
kde3_add_dcop_skels( ${_sources} ${_path}/${_name}.h ) tde_add_dcop_skels( ${_sources} ${_path}/${_name}.h )
# handle .stub files # handle .stub files
elseif( ${_ext} STREQUAL ".stub" ) elseif( ${_ext} STREQUAL ".stub" )
kde3_add_dcop_stubs( ${_sources} ${_path}/${_name}.h ) tde_add_dcop_stubs( ${_sources} ${_path}/${_name}.h )
# handle .kcfgc files # handle .kcfgc files
elseif( ${_ext} STREQUAL ".kcfgc" ) elseif( ${_ext} STREQUAL ".kcfgc" )
kde3_add_kcfg_files( ${_sources} ${_arg} ) tde_add_kcfg_files( ${_sources} ${_arg} )
# handle any other files # handle any other files
else( ${_ext} STREQUAL ".ui" ) else( ${_ext} STREQUAL ".ui" )

Loading…
Cancel
Save