add version 0.6 - make external build possible
This commit is contained in:
@@ -9,9 +9,9 @@ set(ULIB_VERSION @PROJECT_VERSION@)
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
# Definisce le directory per l'inclusione dei file header
|
||||
# PACKAGE_INCLUDE_INSTALL_DIR è sostituito da configure_package_config_file
|
||||
# con il percorso corretto per l'installazione.
|
||||
# Defines the include directories for the header files
|
||||
# PACKAGE_INCLUDE_INSTALL_DIR is replaced by configure_package_config_file
|
||||
# with the correct path for the installation.
|
||||
set(ULIB_INCLUDE_DIRS "${PACKAGE_INCLUDE_INSTALL_DIR}")
|
||||
|
||||
get_filename_component(ULIB_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
@@ -29,38 +29,64 @@ set(uLib_INSTALL_TARGETS_FILE
|
||||
# We use a logic based on the presence of the build target file
|
||||
# to determine if we are in a local build.
|
||||
if(EXISTS "${uLib_BUILD_TARGETS_FILE}")
|
||||
message(WARNING " ++ Using uLib build targets")
|
||||
message(STATUS " ++ Using uLib build targets")
|
||||
|
||||
include("${uLib_BUILD_TARGETS_FILE}")
|
||||
set_and_check(ULIB_INCLUDE_DIRS "@ULIB_SOURCE_DIR@")
|
||||
set_and_check(ULIB_INCLUDE_DIRS "@ULIB_SOURCE_DIR@/src")
|
||||
set_and_check(ULIB_LIBRARY_DIRS "${ULIB_CMAKE_DIR}")
|
||||
set(ULIB_BUILD_DIR ${ULIB_CMAKE_DIR})
|
||||
|
||||
# Target that builds uLib inside its build directory
|
||||
add_custom_target(uLib_dependency_target
|
||||
COMMAND echo " --------------------------------- "
|
||||
COMMAND echo " - Building uLib as a dependency - "
|
||||
COMMAND echo " --------------------------------- "
|
||||
COMMAND echo ""
|
||||
COMMAND ${CMAKE_COMMAND} --build ${ULIB_BUILD_DIR}
|
||||
COMMAND echo ""
|
||||
WORKING_DIRECTORY ${ULIB_BUILD_DIR}
|
||||
)
|
||||
|
||||
add_library(uLib_dependency INTERFACE)
|
||||
add_dependencies(uLib_dependency uLib_dependency_target)
|
||||
link_libraries(uLib_dependency)
|
||||
|
||||
else()
|
||||
message(STATUS " ++ UsingLib install targets")
|
||||
message(STATUS " ++ Using uLib installed targets")
|
||||
|
||||
include("${uLib_INSTALL_TARGETS_FILE}")
|
||||
set_and_check(ULIB_INCLUDE_DIRS "@PACKAGE_PACKAGE_INSTALL_INC_DIR@")
|
||||
set(ULIB_SYSCONFIG_DIR "@PACKAGE_PACKAGE_INSTALL_ETC_DIR@")
|
||||
set_and_check(ULIB_CMAKE_DIR "@PACKAGE_PACKAGE_INSTALL_CMAKE_DIR@")
|
||||
set_and_check(ULIB_LIBRARY_DIRS "@PACKAGE_PACKAGE_INSTALL_LIB_DIR@")
|
||||
set_and_check(ULIB_INCLUDE_DIRS "@PACKAGE_INSTALL_INC_DIR@")
|
||||
set(ULIB_SYSCONFIG_DIR "@PACKAGE_INSTALL_ETC_DIR@")
|
||||
set_and_check(ULIB_CMAKE_DIR "@PACKAGE_INSTALL_CMAKE_DIR@")
|
||||
set_and_check(ULIB_LIBRARY_DIRS "@PACKAGE_INSTALL_LIB_DIR@")
|
||||
endif()
|
||||
|
||||
# --- Add required packages from uLib ---
|
||||
# TODO: this should be selected if components are active
|
||||
#
|
||||
set(Boost_USE_STATIC_LIBS OFF)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
find_package(Boost 1.45.0 COMPONENTS program_options filesystem REQUIRED)
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
link_libraries(${Boost_LIBRARIES})
|
||||
|
||||
find_package(Eigen3 CONFIG REQUIRED)
|
||||
include(${EIGEN3_USE_FILE})
|
||||
|
||||
find_package(ROOT CONFIG REQUIRED)
|
||||
include(${ROOT_USE_FILE})
|
||||
|
||||
find_package(VTK REQUIRED)
|
||||
# include(${VTK_USE_FILE})
|
||||
|
||||
|
||||
|
||||
link_directories("${ULIB_LIBRARY_DIRS}")
|
||||
set(ULIB_LIBRARIES "@ULIB_SHARED_LIBRARIES@")
|
||||
|
||||
# include("${ULIB_CMAKE_DIR}/uLibTargets.cmake")
|
||||
check_required_components(uLib)
|
||||
|
||||
# Imposta la variabile per indicare che il pacchetto è stato trovato.
|
||||
# Set the variable to indicate that the package has been found.
|
||||
set(uLib_FOUND TRUE)
|
||||
|
||||
|
||||
# # Compute paths
|
||||
# get_filename_component(ULIB_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
# set(ULIB_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
|
||||
|
||||
# # Our library dependencies (contains definitions for IMPORTED targets)
|
||||
# include("${ULIB_CMAKE_DIR}/uLibTargets.cmake")
|
||||
|
||||
# # These are IMPORTED targets created by ULibTargets.cmake
|
||||
# set(ULIB_LIBRARIES @ULIB_SHARED_LIBRARIES@)
|
||||
|
||||
Reference in New Issue
Block a user