232 lines
7.1 KiB
CMake
232 lines
7.1 KiB
CMake
|
|
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
|
|
####### Any changes to this file will be overwritten by the next CMake run ####
|
|
####### The input file was PkgLibConfig.cmake.in ########
|
|
|
|
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
|
|
|
|
macro(set_and_check _var _file)
|
|
set(${_var} "${_file}")
|
|
if(NOT EXISTS "${_file}")
|
|
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
|
|
endif()
|
|
endmacro()
|
|
|
|
macro(check_required_components _NAME)
|
|
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
|
if(NOT ${_NAME}_${comp}_FOUND)
|
|
if(${_NAME}_FIND_REQUIRED_${comp})
|
|
set(${_NAME}_FOUND FALSE)
|
|
endif()
|
|
endif()
|
|
endforeach()
|
|
endmacro()
|
|
|
|
####################################################################################
|
|
find_package(cgv COMPONENTS cgv_base cgv_type cgv_data cgv_media)
|
|
find_package(ZLIB)
|
|
find_package(PNG)
|
|
find_package(JPEG)
|
|
set(FIND_NAMES cgv ZLIB PNG JPEG)
|
|
|
|
|
|
set(cmi_io_INCLUDE_DIR "" "")
|
|
set(cmi_io_LIBRARIES "")
|
|
set(cmi_io_SHARED_DEFINITIONS "")
|
|
set(cmi_io_STATIC_DEFINITIONS "")
|
|
set(cmi_io_COMMON_DEFINITIONS "")
|
|
set(cmi_io_IS_MODULE 1)
|
|
|
|
# Append the found information to our local information if possible
|
|
foreach(fn ${FIND_NAMES})
|
|
|
|
if (NOT ${fn}_FOUND)
|
|
string(TOUPPER ${fn} fn)
|
|
endif()
|
|
|
|
if (NOT ${fn}_FOUND)
|
|
string(TOLOWER ${fn} fn)
|
|
endif()
|
|
|
|
if (${fn}_FOUND)
|
|
# Try to append the include directories with different names
|
|
list(APPEND cmi_io_INCLUDE_DIR
|
|
${${fn}_INCLUDE_DIR}
|
|
${${fn}_INCLUDE_DIRS}
|
|
${${fn}_INCLUDE_PATH}
|
|
${${fn}_INCLUDES}
|
|
"")
|
|
|
|
# Try to append the library names with different names
|
|
list(APPEND cmi_io_LIBRARIES
|
|
${${fn}_LIBRARIES}
|
|
${${fn}_LIBRARY}
|
|
"")
|
|
|
|
# Try to append the definitions
|
|
list(APPEND cmi_io_SHARED_DEFINITIONS ${${fn}_SHARED_DEFINITIONS} "")
|
|
list(APPEND cmi_io_STATIC_DEFINITIONS ${${fn}_STATIC_DEFINITIONS} "")
|
|
list(APPEND cmi_io_COMMON_DEFINITIONS ${${fn}_COMMON_DEFINITIONS} "")
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
#list(APPEND cmi_io_INCLUDE_DIR "")
|
|
if (EXISTS "/home/hodasemi/Documents/Workspace/CGII/framework/cgv/plugins/cmi_io")
|
|
list(APPEND cmi_io_INCLUDE_DIR "/home/hodasemi/Documents/Workspace/CGII/framework/cgv/plugins/cmi_io")
|
|
list(APPEND cmi_io_INCLUDE_DIR "/home/hodasemi/Documents/Workspace/CGII/framework/cgv/plugins/cmi_io/..")
|
|
else()
|
|
list(APPEND cmi_io_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/framework/include/plugins")
|
|
list(APPEND cmi_io_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/framework/include/plugins/cmi_io")
|
|
endif()
|
|
|
|
# Remove duplicates from the include dirs
|
|
list(REMOVE_DUPLICATES cmi_io_INCLUDE_DIR)
|
|
|
|
# For compatibility also set the cmi_io_INCLUDE_DIR and cmi_io_INCLUDE_PATH variable
|
|
set(cmi_io_INCLUDE_DIRS "${cmi_io_INCLUDE_DIR}")
|
|
set(cmi_io_INCLUDES "${cmi_io_INCLUDE_DIR}")
|
|
set(cmi_io_INCLUDE_PATH "${cmi_io_INCLUDE_DIR}")
|
|
|
|
|
|
# Make a list of all configurations
|
|
set(CONFIGS "")
|
|
foreach(conf ${CMAKE_CONFIGURATION_TYPES})
|
|
string(TOUPPER "${conf}" UPPER_CONF)
|
|
list(APPEND CONFIGS "${UPPER_CONF}")
|
|
endforeach()
|
|
|
|
# On unix systems the CMAKE_CONFIGURATION_TYPES variable is not set
|
|
if (NOT CONFIGS)
|
|
set(CONFIGS RELEASE DEBUG)
|
|
endif()
|
|
|
|
# Construct the library names
|
|
if (BUILD_SHARED_LIBS)
|
|
set(cmi_io_OUTPUT_NAME_RELEASE "cmi_io")
|
|
set(cmi_io_OUTPUT_NAME_DEBUG "cmi_io_d")
|
|
if (cmi_io_IS_MODULE)
|
|
set(TARGET_POSTFIX "MODULE")
|
|
else()
|
|
set(TARGET_POSTFIX "SHARED")
|
|
endif()
|
|
else()
|
|
set(cmi_io_OUTPUT_NAME_RELEASE "cmi_io_static")
|
|
set(cmi_io_OUTPUT_NAME_DEBUG "cmi_io_static_d")
|
|
set(TARGET_POSTFIX "STATIC")
|
|
endif()
|
|
|
|
|
|
|
|
# See if we can go the easy way when our dependency is also a target to be built
|
|
if (TARGET cmi_io)
|
|
set(cmi_io_LIBRARIES cmi_io)
|
|
set(cmi_io_FOUND TRUE)
|
|
endif()
|
|
|
|
# See if the imported target already exists
|
|
if (TARGET cmi_io_IMPORTED_${TARGET_POSTFIX})
|
|
set(cmi_io_LIBRARIES cmi_io_IMPORTED_${TARGET_POSTFIX})
|
|
set(cmi_io_FOUND TRUE)
|
|
endif()
|
|
|
|
# If our variable is not set then we generate a new target
|
|
# where we collect names for every configuration
|
|
if (NOT cmi_io_FOUND)
|
|
set(FIND_PATHS "${PACKAGE_PREFIX_DIR}/framework/lib/unix"
|
|
"${PACKAGE_PREFIX_DIR}/framework/bin/unix"
|
|
"${PACKAGE_PREFIX_DIR}/build/bin/unix"
|
|
"${PACKAGE_PREFIX_DIR}/build/lib/unix")
|
|
|
|
# Try to find libraries for all configurations
|
|
if (cmi_io_IS_MODULE AND BUILD_SHARED_LIBS AND WIN32)
|
|
foreach(conf ${CONFIGS})
|
|
find_file(cmi_io_LIB_${conf} ${cmi_io_OUTPUT_NAME_${conf}}.dll PATHS ${FIND_PATHS})
|
|
endforeach()
|
|
else()
|
|
foreach(conf ${CONFIGS})
|
|
find_library(cmi_io_LIB_${conf} ${cmi_io_OUTPUT_NAME_${conf}} PATHS ${FIND_PATHS})
|
|
endforeach()
|
|
endif()
|
|
|
|
# Check if all library types could be found
|
|
set(ALL_LIBS_FOUND TRUE)
|
|
foreach(conf ${CONFIGS})
|
|
if (NOT cmi_io_LIB_${conf})
|
|
set(ALL_LIBS_FOUND FALSE)
|
|
break()
|
|
endif()
|
|
endforeach()
|
|
|
|
# If some libraries could not be found then substitute their name with the
|
|
# first library name that could be found
|
|
if (NOT ALL_LIBS_FOUND)
|
|
set(FIRST_FOUND_NAME FALSE)
|
|
|
|
foreach(conf ${CONFIGS})
|
|
if(cmi_io_LIB_${conf})
|
|
set(FIRST_FOUND_NAME ${cmi_io_LIB_${conf}})
|
|
break()
|
|
endif()
|
|
endforeach()
|
|
|
|
# If no library was found then we failed
|
|
if (NOT FIRST_FOUND_NAME)
|
|
# FIXME: add better error handling here
|
|
message(FATAL_ERROR "Could not find library cmi_io")
|
|
set(cmi_io_FOUND FALSE)
|
|
return()
|
|
endif()
|
|
|
|
# Set all library names that were not found
|
|
foreach(conf ${CONFIGS})
|
|
if(NOT cmi_io_LIB_${conf})
|
|
set(cmi_io_LIB_${conf} ${FIRST_FOUND_NAME})
|
|
endif()
|
|
endforeach()
|
|
endif()
|
|
|
|
# Generate an imported target which each location for different configurations set accordingly
|
|
add_library(cmi_io_IMPORTED_${TARGET_POSTFIX} ${TARGET_POSTFIX} IMPORTED GLOBAL)
|
|
|
|
foreach(conf ${CONFIGS})
|
|
set_target_properties(cmi_io_IMPORTED_${TARGET_POSTFIX} PROPERTIES
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES_${conf} "CXX"
|
|
IMPORTED_LINK_INTERFACE_LIBRARIES_${conf} "${cmi_io_LIBRARIES}"
|
|
IMPORTED_LOCATION_${conf} "${cmi_io_LIB_${conf}}"
|
|
IMPORTED_IMPLIB_${conf} "${cmi_io_LIB_${conf}}")
|
|
endforeach()
|
|
|
|
# Also add definitions if no build type was specified. Set this to be the release type
|
|
set_target_properties(cmi_io_IMPORTED_${TARGET_POSTFIX} PROPERTIES
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
|
|
IMPORTED_LINK_INTERFACE_LIBRARIES "${cmi_io_LIBRARIES}"
|
|
IMPORTED_LOCATION "${cmi_io_LIB_RELEASE}"
|
|
IMPORTED_IMPLIB "${cmi_io_LIB_RELEASE}")
|
|
|
|
# Finally set the libraries info to be exported
|
|
set(cmi_io_LIBRARIES "cmi_io_IMPORTED_${TARGET_POSTFIX}")
|
|
set(cmi_io_FOUND TRUE)
|
|
endif()
|
|
|
|
|
|
|
|
# Set definitions
|
|
set(cmi_io_NEW_SHARED_DEFINITIONS "_UNICODE;UNICODE;_USRDLL")
|
|
set(cmi_io_NEW_STATIC_DEFINITIONS "_UNICODE;UNICODE;CMI_IO_FORCE_STATIC;CGV_FORCE_STATIC")
|
|
set(cmi_io_NEW_COMMON_DEFINITIONS "_UNICODE;UNICODE;CMI_IO_FORCE_STATIC;CGV_FORCE_STATIC")
|
|
|
|
list(APPEND cmi_io_COMMON_DEFINITIONS "${cmi_io_NEW_COMMON_DEFINITIONS}")
|
|
list(APPEND cmi_io_STATIC_DEFINITIONS "${cmi_io_COMMON_DEFINITIONS}${cmi_io_NEW_STATIC_DEFINITIONS}")
|
|
list(REMOVE_DUPLICATES cmi_io_COMMON_DEFINITIONS)
|
|
list(REMOVE_DUPLICATES cmi_io_STATIC_DEFINITIONS)
|
|
|
|
|
|
if (BUILD_SHARED_LIBS)
|
|
set(cmi_io_DEFINITIONS "${cmi_io_COMMON_DEFINITIONS};${cmi_io_NEW_SHARED_DEFINITIONS}")
|
|
else()
|
|
set(cmi_io_DEFINITIONS "${cmi_io_STATIC_DEFINITIONS}")
|
|
endif()
|
|
|
|
|
|
|