Alex says FindOkular.cmake is not the way to go and that we need to install an OkularConfig.cmake

That get_filename_component thing seems quite fragile and hacky to me but he is the expert :-)

CCMAIL: neundorf@kde.org

svn path=/trunk/KDE/kdegraphics/cmake/modules/; revision=1179984
remotes/origin/KDE/4.6
Albert Astals Cid 16 years ago
parent a86bbe9053
commit 64063fe996
  1. 8
      CMakeLists.txt
  2. 17
      OkularConfig.cmake
  3. 1
      cmake/modules/CMakeLists.txt
  4. 38
      cmake/modules/FindOkular.cmake

@ -5,6 +5,7 @@ add_subdirectory( generators )
add_subdirectory( tests )
include(OkularConfigureChecks.cmake)
include(MacroWriteBasicCMakeVersionFile)
if(NOT WIN32)
set(MATH_LIB m)
@ -181,3 +182,10 @@ install(TARGETS okularpart DESTINATION ${PLUGIN_INSTALL_DIR})
install( FILES okular_part.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install( FILES part.rc DESTINATION ${DATA_INSTALL_DIR}/okular )
########### cmake files #################
macro_write_basic_cmake_version_file(${CMAKE_CURRENT_BINARY_DIR}/OkularConfigVersion.cmake 0 11 80)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/OkularConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/OkularConfigVersion.cmake
DESTINATION ${LIB_INSTALL_DIR}/cmake/Okular )

@ -0,0 +1,17 @@
# get from the full path to OkularConfig.cmake up to the base dir dir:
get_filename_component( _okularBaseDir ${CMAKE_CURRENT_LIST_FILE} PATH)
get_filename_component( _okularBaseDir ${_okularBaseDir} PATH)
get_filename_component( _okularBaseDir ${_okularBaseDir} PATH)
get_filename_component( _okularBaseDir ${_okularBaseDir} PATH)
# find the full paths to the library and the includes:
find_path(OKULAR_INCLUDE_DIR okular/core/document.h
HINTS ${_okularBaseDir}/include
NO_DEFAULT_PATH)
find_library(OKULAR_CORE_LIBRARY okularcore
HINTS ${_okularBaseDir}/lib
NO_DEFAULT_PATH)
set(OKULAR_LIBRARIES ${OKULAR_CORE_LIBRARY})

@ -1,7 +1,6 @@
# explicitely install the "public" cmake files
set(cmakeFiles
FindOkular.cmake
FindKSane.cmake
)

@ -1,38 +0,0 @@
# - Find Okular
# Find the Okular core library
#
# This module defines
# OKULAR_FOUND - whether the Okular core library was found
# OKULAR_LIBRARIES - the Okular core library
# OKULAR_INCLUDE_DIR - the include path of the Okular core library
#
if (OKULAR_INCLUDE_DIR AND OKULAR_LIBRARIES)
# Already in cache
set (OKULAR_FOUND TRUE)
else (OKULAR_INCLUDE_DIR AND OKULAR_LIBRARIES)
find_library (OKULAR_LIBRARIES
NAMES
okularcore
PATHS
${LIB_INSTALL_DIR}
${KDE4_LIB_DIR}
)
find_path (OKULAR_INCLUDE_DIR
NAMES
okular/core/document.h
PATHS
${INCLUDE_INSTALL_DIR}
${KDE4_INCLUDE_DIR}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Okular DEFAULT_MSG OKULAR_LIBRARIES OKULAR_INCLUDE_DIR)
endif (OKULAR_INCLUDE_DIR AND OKULAR_LIBRARIES)
mark_as_advanced(OKULAR_INCLUDE_DIR OKULAR_LIBRARIES)
Loading…
Cancel
Save