Add caching of variables from checks results and add conditions

to avoid unnecessary repetition of checks.

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

@ -28,6 +28,8 @@ if( NOT TDE_FOUND )
if( NOT KDECONFIG_EXECUTABLE )
tde_message_fatal( "tde-config are NOT found." )
endif( NOT KDECONFIG_EXECUTABLE )
set( KDECONFIG_EXECUTABLE ${KDECONFIG_EXECUTABLE}
CACHE INTERNAL "tde-config executable" )
endif( NOT DEFINED KDECONFIG_EXECUTABLE )
set( ENV{LD_LIBRARY_PATH} "${TDE_LIBDIR}:$ENV{LD_LIBRARY_PATH}" )
@ -41,7 +43,7 @@ if( NOT TDE_FOUND )
# parse tde-config output, to extract TDE version
string( REGEX MATCH "TDE: R([0-9\\.]+).*" __dummy "${_version}" )
set( TDE_VERSION "${CMAKE_MATCH_1}" )
set( TDE_VERSION "${CMAKE_MATCH_1}" CACHE INTERNAL "" )
# ask tde-config for few paths
macro( __internal_get_path __type __var )
@ -80,8 +82,12 @@ if( NOT TDE_FOUND )
__internal_find_program( tdeconfig_compiler KDE3_KCFGC_EXECUTABLE )
__internal_find_program( maketdewidgets KDE3_MAKETDEWIDGETS_EXECUTABLE )
# Don't use __internal_find_program due to it's not mandatory
if( NOT DEFINED TDELFEDITOR_EXECUTABLE )
find_program( TDELFEDITOR_EXECUTABLE NAMES tdelfeditor
HINTS "${TDE_PREFIX}/bin" ${BIN_INSTALL_DIR} OUTPUT_STRIP_TRAILING_WHITESPACE )
set( TDELFEDITOR_EXECUTABLE ${TDELFEDITOR_EXECUTABLE}
CACHE INTERNAL "tdelfeditor executable" )
endif( )
# dcopidlng is a bash script which using tde-config;
# if PATH to tde-config is not set, dcopidlng will fail;

@ -13,6 +13,7 @@ macro( tqt_message )
message( STATUS "${ARGN}" )
endmacro( )
if( NOT TQT_FOUND )
pkg_search_module( TQT tqt )
if( NOT TQT_FOUND )
@ -68,7 +69,8 @@ tqt_message( " uic path: ${UIC_EXECUTABLE}" )
# tqt-replace script
set( TQT_REPLACE_SCRIPT "${TQT_PREFIX}/bin/tqt-replace" )
set( TQT_REPLACE_SCRIPT "${TQT_PREFIX}/bin/tqt-replace"
CACHE FILEPATH "TQt replace script path" )
if( NOT EXISTS ${TQT_REPLACE_SCRIPT} )
tde_message_fatal( "tqt-replace not found!\n Check tqt installation." )
@ -101,6 +103,9 @@ tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
foreach( _flag ${TQT_CFLAGS} ${TQT_CFLAGS_OTHER} )
set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS} ${_flag}" )
endforeach()
set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS}" CACHE INTERNAL "" )
endif( NOT TQT_FOUND )
# Set compiler flags according to build type
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG" )

@ -2311,6 +2311,7 @@ endif( )
##### tde_setup_architecture_flags
macro( tde_setup_architecture_flags )
if( NOT DEFINED LINKER_IMMEDIATE_BINDING_FLAGS )
message( STATUS "Detected ${CMAKE_SYSTEM_PROCESSOR} CPU architecture" )
## Immediate symbol binding is available only for gcc but not on ARM architectures
if( ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" AND NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES arm* AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
@ -2324,6 +2325,7 @@ macro( tde_setup_architecture_flags )
set( TDE_PIE_CFLAGS -fPIE )
set( TDE_PIE_LDFLAGS -pie )
endif( HAVE_PIE_SUPPORT )
endif( )
endmacro( )
@ -2337,7 +2339,7 @@ macro( tde_setup_gcc_visibility )
tde_message_fatal( "gcc visibility support was requested, but your system is not *NIX" )
endif( NOT UNIX )
if( TQT_FOUND )
if( TQT_FOUND AND NOT DEFINED HAVE_TQT_VISIBILITY )
find_library( TQT_LIBFILE tqt-mt HINTS "${TQT_LIBRARY_DIRS}" )
if( NOT "${TQT_LIBFILE}" STREQUAL "TQT_LIBFILE-NOTFOUND" )
message( STATUS "Performing Test HAVE_TQT_VISIBILITY" )
@ -2350,11 +2352,12 @@ macro( tde_setup_gcc_visibility )
message( STATUS "Performing Test HAVE_TQT_VISIBILITY - Failed" )
tde_message_fatal( "gcc visibility support was requested, but not supported in tqt library" )
endif( )
set( HAVE_TQT_VISIBILITY 1 CACHE INTERNAL "" )
message( STATUS "Performing Test HAVE_TQT_VISIBILITY - Success" )
endif( )
endif( TQT_FOUND )
endif( TQT_FOUND AND NOT DEFINED HAVE_TQT_VISIBILITY )
if( TDE_FOUND )
if( TDE_FOUND AND NOT DEFINED HAVE_TDE_VISIBILITY )
find_file( TDEMACROS_H kdemacros.h HINTS "${TDE_INCLUDE_DIR}" )
if( NOT "${TDEMACROS_H}" STREQUAL "TDEMACROS_H-NOTFOUND" )
tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${TDE_INCLUDE_DIR}" )
@ -2371,9 +2374,9 @@ macro( tde_setup_gcc_visibility )
tde_message_fatal( "gcc visibility support was requested, but not supported in tdelibs" )
endif( NOT HAVE_TDE_VISIBILITY )
endif( )
endif( TDE_FOUND )
endif( TDE_FOUND AND NOT DEFINED HAVE_TDE_VISIBILITY )
set( __KDE_HAVE_GCC_VISIBILITY 1 )
set( __KDE_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( )
@ -2520,7 +2523,8 @@ macro( tde_setup_dbus )
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if( DBUS_SYSTEM_CONF_BASE )
set( DBUS_SYSTEM_CONF_DIRECTORY "${DBUS_SYSTEM_CONF_BASE}/dbus-1/system.d" )
set( DBUS_SYSTEM_CONF_DIRECTORY "${DBUS_SYSTEM_CONF_BASE}/dbus-1/system.d"
CACHE PATH "Path for DBUS system configuration files" )
message( STATUS "Using " ${DBUS_SYSTEM_CONF_DIRECTORY} " for DBUS system configuration files" )
else( )
tde_message_fatal( "Can not find the base directory for the dbus-1 configuration" )
@ -2535,7 +2539,8 @@ macro( tde_setup_dbus )
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if( DBUS_SYSTEM_CONF_BASE )
set( DBUS_SESSION_CONF_DIRECTORY "${DBUS_SYSTEM_CONF_BASE}/dbus-1/session.d" )
set( DBUS_SESSION_CONF_DIRECTORY "${DBUS_SYSTEM_CONF_BASE}/dbus-1/session.d"
CACHE PATH "Path for DBUS session configuration files" )
message( STATUS "Using " ${DBUS_SESSION_CONF_DIRECTORY} " for DBUS session configuration files" )
else( )
tde_message_fatal( "Can not find the base directory for the dbus-1 configuration" )
@ -2549,6 +2554,8 @@ macro( tde_setup_dbus )
OUTPUT_VARIABLE DBUS_SESSION_DIRECTORY
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set( DBUS_SESSION_DIRECTORY "${DBUS_SESSION_DIRECTORY}"
CACHE PATH "Path for DBUS session service files" )
message( STATUS "Using " ${DBUS_SESSION_DIRECTORY} " for DBUS session service files" )
endif( )
@ -2567,6 +2574,8 @@ macro( tde_setup_dbus )
tde_message_fatal( "Directory for DBUS system service files can not be determined." )
endif( )
endif( )
set( DBUS_SERVICE_DIRECTORY "${DBUS_SERVICE_DIRECTORY}"
CACHE PATH "Path for DBUS system service files" )
message( STATUS "Using " ${DBUS_SERVICE_DIRECTORY} " for DBUS system service files" )
endif( )
@ -2625,6 +2634,8 @@ macro( tde_setup_polkit )
OUTPUT_VARIABLE POLKIT_ACTIONS_DIRECTORY
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set( POLKIT_ACTIONS_DIRECTORY "${POLKIT_ACTIONS_DIRECTORY}"
CACHE PATH "Path for PolicyKit action files" )
message( STATUS "Using " ${POLKIT_ACTIONS_DIRECTORY} " for PolicyKit action files" )
endif( )

Loading…
Cancel
Save