Compare commits

...

22 Commits

Author SHA1 Message Date
Slávek Banko 5283559e25
tde_import: Always do 'include' because macro can be called in a scope that is not global.
1 week ago
Michele Calgaro 5e1ef63e20
Remove __KDE_HAVE_GCC_VISIBILITY
2 weeks ago
Michele Calgaro 713b969b4e
Rename __KDE_HAVE_GCC_VISIBILITY to __TDE_HAVE_GCC_VISIBILITY. Temporarily __KDE_HAVE_GCC_VISIBILITY is still provided, till renaming on all TDE code base is completed.
2 weeks ago
Slávek Banko 03a1c2f4fd
tde_uic: Cover all wizard include variants and class name in one regexp.
3 weeks ago
Michele Calgaro f1352532be
Rename kdemacros.h to tdemacros.h
4 weeks ago
Slávek Banko 68452c7f2d
tde_import: Reducing the noise, more common listing of the result.
2 months ago
Michele Calgaro d9c415570a
Add support for relative paths in '_tde_internal_setup_path'
2 months ago
Michele Calgaro 9d38396777
Replace KDE_[NO_]EXPORT with TDE_[NO_]EXPORT
3 months ago
Michele Calgaro 9a81dc3923
Update version to R14.1.3~[DEVELOPMENT]
3 months ago
Michele Calgaro 1ec544251e
Update version to R14.1.2
3 months ago
Slávek Banko e6fdb4b58d
Fix incorrect backslash in tde_set_project_version macro
4 months ago
Michele Calgaro 4af11cf947
Set cmake minimum version in a centralized place
4 months ago
Alexander Golubev 10b0187669
Add support for multiline messages in tde_message_* macros
5 months ago
Michele Calgaro 8b6215c660
Simplify code since cmake minimum version is now 3.5
5 months ago
Slávek Banko 76ca9f74ef
Raise the minimum required version of CMake to 3.5.
9 months ago
Slávek Banko bb49d85437
Update version to R14.1.2~[DEVELOPMENT]
9 months ago
Michele Calgaro b4e46115c9
Update version to R14.1.1
10 months ago
Slávek Banko 3fedede7e6
Save and restore CMake policies so that it does not cause CMP0011
1 year ago
Slávek Banko 4e5ddd484f
Set CMake policy CMP0057 to NEW.
1 year ago
Denis Kozadaev 1af8cf3511
tde_setup_architecture_flags: Add test for liner flag -pie or -ztype=pie.
1 year ago
Michele Calgaro 570dbf6e74
Add macro to display a warning message for developers
1 year ago
Michele Calgaro 6ae3ce5bb6
Update version to R14.1.1~[DEVELOPMENT]
1 year ago

@ -14,7 +14,13 @@ if( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}" )
##### general package setup #####################
cmake_minimum_required( VERSION 3.1 )
# building tde-cmake requires reading the minimum required version
# from the source files, because there may be a different version
# of tde-cmake already installed in the system. Trying to build
# tde-cmake with a lower minimum version would not be allowed then.
include( ${CMAKE_SOURCE_DIR}/modules/TDEVersion.cmake )
cmake_minimum_required( VERSION ${TDE_CMAKE_MINIMUM_VERSION} )
project( tde-cmake-rules )

@ -15,7 +15,11 @@
#
#################################################
include( CheckCXXCompilerFlag )
#################################################
#####
##### Need cmake minimum version
include( TDEVersion )
@ -24,8 +28,8 @@ include( TDEVersion )
##### initialization...
if( NOT TDE_CMAKE_ROOT )
if( "${CMAKE_VERSION}" VERSION_LESS "3.1" )
message( FATAL_ERROR "CMake >= 3.1.0 required" )
if( "${CMAKE_VERSION}" VERSION_LESS "${TDE_CMAKE_MINIMUM_VERSION}" )
message( FATAL_ERROR "CMake >= ${TDE_CMAKE_MINIMUM_VERSION} required" )
endif()
if( ${CMAKE_CURRENT_LIST_DIR} STREQUAL ${CMAKE_ROOT}/Modules )
@ -66,14 +70,63 @@ if( NOT TDE_CMAKE_ROOT )
endif()
#################################################
#####
##### set necessary CMake policies
cmake_policy( PUSH )
if( POLICY CMP0057 )
# necessary for CheckLinkerFlag
cmake_policy( SET CMP0057 NEW )
endif()
#################################################
#####
##### necessary includes
include( CheckCXXCompilerFlag )
include( CheckCXXSourceCompiles )
include( CheckLinkerFlag OPTIONAL )
include( CheckSymbolExists )
include( CheckTypeSize )
#################################################
#####
##### tde_concat_msg
macro( tde_concat_msg _msg )
unset( ${_msg} )
foreach( _arg ${ARGN} )
string( APPEND ${_msg} " ${_arg}\n" )
endforeach()
endmacro( tde_concat_msg )
#################################################
#####
##### tde_message_author_warning
function( tde_message_author_warning )
tde_concat_msg( _msg ${ARGV} )
message( AUTHOR_WARNING
"-------------------------------------------------\n"
"${_msg}"
"-------------------------------------------------" )
endfunction( tde_message_author_warning )
#################################################
#####
##### tde_message_fatal
macro( tde_message_fatal )
tde_concat_msg( _msg ${ARGV} )
message( FATAL_ERROR
"#################################################\n"
" ${ARGV}\n"
"${_msg}"
"#################################################" )
endmacro( tde_message_fatal )
@ -193,9 +246,15 @@ macro( tde_read_src_metadata )
endmacro( tde_read_src_metadata )
################################################
#####
##### finalization as a slave part
if( DEFINED MASTER_SOURCE_DIR )
cmake_policy( POP )
return( )
endif( )
########### slave part ends here ###############
@ -813,19 +872,29 @@ endfunction( )
macro( tde_import _library )
message( STATUS "checking for '${_library}'" )
string( TOUPPER "BUILD_${_library}" _build )
if( ${_build} )
message( STATUS " ok, activated for build" )
else()
if( EXISTS "${TDE_CMAKE_DIR}/${_library}.cmake" )
include( "${TDE_CMAKE_DIR}/${_library}.cmake" )
elseif( EXISTS "${TQT_CMAKE_DIR}/${_library}.cmake" )
include( "${TQT_CMAKE_DIR}/${_library}.cmake" )
if( NOT DEFINED TDE_IMPORT_${_library} )
message( STATUS "Checking for '${_library}'" )
string( TOUPPER "BUILD_${_library}" _build )
if( ${_build} )
message( STATUS "Checking for '${_library}' - ok, activated for build" )
set( TDE_IMPORT_${_library} "build" CACHE INTERNAL "Library ${_library} activated for build" )
else()
tde_message_fatal( "'${_library}' is required, but is not installed nor selected for build" )
if( EXISTS "${TDE_CMAKE_DIR}/${_library}.cmake" )
set( tde_import_include "${TDE_CMAKE_DIR}/${_library}.cmake" )
elseif( EXISTS "${TQT_CMAKE_DIR}/${_library}.cmake" )
set( tde_import_include "${TQT_CMAKE_DIR}/${_library}.cmake" )
else()
tde_message_fatal( "'${_library}' is required, but is not installed nor selected for build" )
endif()
include( "${tde_import_include}" )
message( STATUS "Checking for '${_library}' - ok, found import file" )
set( TDE_IMPORT_${_library} "import:${tde_import_include}" CACHE INTERNAL "Library ${_library} imported" )
endif()
else()
if( "${TDE_IMPORT_${_library}}" MATCHES "^import:" )
string( REGEX REPLACE "^import:" "" tde_import_include "${TDE_IMPORT_${_library}}" )
include( "${tde_import_include}" )
endif()
message( STATUS " ok, found import file" )
endif()
endmacro()
@ -1093,11 +1162,7 @@ macro( tde_add_library _arg_target )
# set -fPIC flag for static libraries
if( _static_pic )
if( "${CMAKE_VERSION}" VERSION_LESS "2.8.9" )
set_target_properties( ${_target} PROPERTIES COMPILE_FLAGS -fPIC )
else( )
set_target_properties( ${_target} PROPERTIES POSITION_INDEPENDENT_CODE ON )
endif( )
set_target_properties( ${_target} PROPERTIES POSITION_INDEPENDENT_CODE ON )
endif( _static_pic )
# set version
@ -1138,23 +1203,16 @@ macro( tde_add_library _arg_target )
# set private linked libraries
if( _link_private )
if( NOT ${CMAKE_VERSION} VERSION_LESS "2.8.12" )
if( _link )
list( INSERT _link 0 "PUBLIC" )
endif()
list( INSERT _link_private 0 "PRIVATE" )
if( _link )
list( INSERT _link 0 "PUBLIC" )
endif()
list( INSERT _link_private 0 "PRIVATE" )
list( INSERT _link 0 ${_link_private} )
endif( _link_private )
# set link libraries
if( _link )
if( _embed AND ${CMAKE_VERSION} VERSION_EQUAL "2.8.12.0" )
# hack for broken CMake 2.8.12.0
set_target_properties( ${_target} PROPERTIES LINK_LIBRARIES "${_link}" )
else( _embed AND ${CMAKE_VERSION} VERSION_EQUAL "2.8.12.0" )
target_link_libraries( ${_target} ${_link} )
endif( _embed AND ${CMAKE_VERSION} VERSION_EQUAL "2.8.12.0" )
target_link_libraries( ${_target} ${_link} )
endif( )
if( _shared_libs )
string( TOUPPER "${CMAKE_BUILD_TYPE}" _build_type )
@ -2831,7 +2889,29 @@ macro( tde_setup_architecture_flags )
check_cxx_compiler_flag( -fPIE HAVE_PIE_SUPPORT )
if( HAVE_PIE_SUPPORT )
set( TDE_PIE_CFLAGS -fPIE )
set( TDE_PIE_LDFLAGS -pie )
if( ${CMAKE_VERSION} VERSION_LESS "3.18" )
execute_process(COMMAND "${CMAKE_LINKER}" --help
OUTPUT_VARIABLE __linker_help
ERROR_VARIABLE __linker_help)
if( "${__linker_help}" MATCHES "-pie" )
set( LINKER_PIE_SUPPORT 1 )
elseif( "${__linker_help}" MATCHES "type=type.*pie" )
set( LINKER_ZTYPE_PIE_SUPPORT 1 )
endif( )
unset(__linker_help)
else( )
check_linker_flag(CXX -pie LINKER_PIE_SUPPORT)
if( NOT LINKER_PIE_SUPPORT )
check_linker_flag(CXX -ztype=pie LINKER_ZTYPE_PIE_SUPPORT)
endif()
endif()
if( LINKER_PIE_SUPPORT )
set( TDE_PIE_LDFLAGS -pie )
endif( LINKER_PIE_SUPPORT )
if( LINKER_ZTYPE_PIE_SUPPORT )
set( TDE_PIE_LDFLAGS -ztype=pie )
endif( LINKER_ZTYPE_PIE_SUPPORT )
endif( HAVE_PIE_SUPPORT )
set( _reproducible_cxxflags
@ -2858,7 +2938,7 @@ endmacro( )
##### tde_setup_gcc_visibility
macro( tde_setup_gcc_visibility )
if( NOT DEFINED __KDE_HAVE_GCC_VISIBILITY )
if( NOT DEFINED __TDE_HAVE_GCC_VISIBILITY )
if( NOT UNIX )
tde_message_fatal( "gcc visibility support was requested, but your system is not *NIX" )
endif( NOT UNIX )
@ -2882,12 +2962,12 @@ macro( tde_setup_gcc_visibility )
endif( TQT_FOUND AND NOT DEFINED HAVE_TQT_VISIBILITY )
if( TDE_FOUND AND NOT DEFINED HAVE_TDE_VISIBILITY )
find_file( TDEMACROS_H kdemacros.h HINTS "${TDE_INCLUDE_DIR}" )
find_file( TDEMACROS_H tdemacros.h HINTS "${TDE_INCLUDE_DIR}" )
if( NOT "${TDEMACROS_H}" STREQUAL "TDEMACROS_H-NOTFOUND" )
tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${TDE_INCLUDE_DIR}" )
check_cxx_source_compiles( "
#include <${TDEMACROS_H}>
#ifndef __KDE_HAVE_GCC_VISIBILITY
#ifndef __TDE_HAVE_GCC_VISIBILITY
#error gcc visibility is not enabled in tdelibs
#endif
int main() { return 0; } "
@ -2900,7 +2980,7 @@ macro( tde_setup_gcc_visibility )
endif( )
endif( TDE_FOUND AND NOT DEFINED HAVE_TDE_VISIBILITY )
set( __KDE_HAVE_GCC_VISIBILITY 1 CACHE INTERNAL "" )
set( __TDE_HAVE_GCC_VISIBILITY 1 CACHE INTERNAL "" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
endif( )
@ -3164,3 +3244,13 @@ macro( tde_setup_polkit )
endif( )
endmacro( )
#################################################
#####
##### restore CMake policies
cmake_policy( POP )
#################################################

@ -15,10 +15,14 @@
macro( _tde_internal_setup_path _path _default _comment )
if( DEFINED ${_path} )
set( ${_path} "${${_path}}" CACHE PATH "${_comment}" )
else( DEFINED ${_path} )
if( IS_ABSOLUTE ${${_path}} )
set( ${_path} "${${_path}}" CACHE PATH "${_comment}" FORCE )
else( )
set( ${_path} "${CMAKE_INSTALL_PREFIX}/${${_path}}" CACHE PATH "${_comment}" FORCE )
endif( )
else( )
set( ${_path} "${_default}" )
endif( DEFINED ${_path} )
endif( )
endmacro( _tde_internal_setup_path )

@ -9,19 +9,24 @@
#
#################################################
# Centralized place where to set the minimum cmake version required in TDE
set( TDE_CMAKE_MINIMUM_VERSION 3.5 )
#################################################
#####
##### tde_set_project_version
macro( tde_set_project_version )
set( DEFAULT_VERSION "R14.1.0" )
set( DEFAULT_VERSION "R14.1.3~[DEVELOPMENT]" )
unset( VERSION )
if( EXISTS ${CMAKE_SOURCE_DIR}/.tdescminfo )
file( STRINGS ${CMAKE_SOURCE_DIR}/.tdescminfo VERSION_STRING REGEX "^Version:.+$" )
string( REGEX REPLACE "^Version: (R[0-9]+\.[0-9]+\.[0-9]+.*)$" "\\1" VERSION "${VERSION_STRING}" )
string( REGEX REPLACE "^Version: (R[0-9]+\\.[0-9]+\\.[0-9]+.*)$" "\\1" VERSION "${VERSION_STRING}" )
endif()
if( NOT VERSION )

@ -49,10 +49,8 @@ if( _ui_h_content )
string( REGEX REPLACE "#ifndef " "#ifndef UI_" _ui_h_content "${_ui_h_content}" )
string( REGEX REPLACE "#define " "#define UI_" _ui_h_content "${_ui_h_content}" )
if ( TDE_FOUND AND NOT TQT_ONLY )
string( REGEX REPLACE "public TQWizard" "public KWizard" _ui_h_content "${_ui_h_content}" )
string( REGEX REPLACE "public QWizard" "public KWizard" _ui_h_content "${_ui_h_content}" )
string( REGEX REPLACE "#include <ntqwizard.h>" "#include <kwizard.h>" _ui_h_content "${_ui_h_content}" )
string( REGEX REPLACE "#include <qwizard.h>" "#include <kwizard.h>" _ui_h_content "${_ui_h_content}" )
string( REGEX REPLACE "public T?QWizard" "public KWizard" _ui_h_content "${_ui_h_content}" )
string( REGEX REPLACE "#include <(n?t)?qwizard.h>" "#include <kwizard.h>" _ui_h_content "${_ui_h_content}" )
endif( TDE_FOUND AND NOT TQT_ONLY )
file( WRITE ${_ui_basename}.h "${_ui_h_content}" )
endif( )
@ -69,8 +67,7 @@ if( _ui_cpp_content )
string( REGEX REPLACE "${TR_FUNC}\\(\"\"\\)" "TQString::null" _ui_cpp_content "${_ui_cpp_content}" )
string( REGEX REPLACE "${TR_FUNC}\\(\"\", \"\"\\)" "TQString::null" _ui_cpp_content "${_ui_cpp_content}" )
if ( TDE_FOUND AND NOT TQT_ONLY )
string( REGEX REPLACE ": TQWizard\\(" ": KWizard(" _ui_cpp_content "${_ui_cpp_content}" )
string( REGEX REPLACE ": QWizard\\(" ": KWizard(" _ui_cpp_content "${_ui_cpp_content}" )
string( REGEX REPLACE ": T?QWizard\\(" ": KWizard(" _ui_cpp_content "${_ui_cpp_content}" )
set( _ui_cpp_content "#include <kdialog.h>\n#include <tdelocale.h>\n\n${_ui_cpp_content}" )
endif( TDE_FOUND AND NOT TQT_ONLY )
file( WRITE ${_ui_basename}.cpp "${_ui_cpp_content}" )

@ -1,3 +1,3 @@
#include <kdemacros.h>
#include <tdemacros.h>
extern "C" int kdemain(int argc, char* argv[]);
extern "C" KDE_EXPORT int tdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }
extern "C" TDE_EXPORT int tdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }

Loading…
Cancel
Save