From 3b5212067c47753ab8fec88a11014afc23e982db Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Tue, 13 Oct 2020 19:30:58 +0200 Subject: [PATCH] Fix CMake config generation Use standard CMake function to generate the CMake config files. --- AssimpBuildTreeSettings.cmake.in | 3 - AssimpConfigVersion.cmake.in | 11 --- CMakeLists.txt | 97 ++++++++++------------ assimp-config-version.cmake.in | 48 ----------- assimp-config.cmake.in | 1 - assimpTargets-debug.cmake.in | 126 ---------------------------- assimpTargets-release.cmake.in | 127 ----------------------------- assimpTargets.cmake.in | 91 --------------------- cmake/assimp-plain-config.cmake.in | 9 ++ code/CMakeLists.txt | 25 ++---- contrib/zlib/CMakeLists.txt | 1 + 11 files changed, 60 insertions(+), 479 deletions(-) delete mode 100644 AssimpBuildTreeSettings.cmake.in delete mode 100644 AssimpConfigVersion.cmake.in delete mode 100644 assimp-config-version.cmake.in delete mode 100644 assimp-config.cmake.in delete mode 100644 assimpTargets-debug.cmake.in delete mode 100644 assimpTargets-release.cmake.in delete mode 100644 assimpTargets.cmake.in create mode 100644 cmake/assimp-plain-config.cmake.in diff --git a/AssimpBuildTreeSettings.cmake.in b/AssimpBuildTreeSettings.cmake.in deleted file mode 100644 index 342da1b08..000000000 --- a/AssimpBuildTreeSettings.cmake.in +++ /dev/null @@ -1,3 +0,0 @@ -set(ASSIMP_INCLUDE_DIRS - "@PROJECT_SOURCE_DIR@" - "@PROJECT_BINARY_DIR@") diff --git a/AssimpConfigVersion.cmake.in b/AssimpConfigVersion.cmake.in deleted file mode 100644 index 701fa6158..000000000 --- a/AssimpConfigVersion.cmake.in +++ /dev/null @@ -1,11 +0,0 @@ -set(ASSIMP_PACKAGE_VERSION "@ASSIMP_SOVERSION@") - -# Check whether the requested PACKAGE_FIND_VERSION is compatible -if("${ASSIMP_PACKAGE_VERSION}" VERSION_LESS "${ASSIMP_PACKAGE_FIND_VERSION}") - set(ASSIMP_PACKAGE_VERSION_COMPATIBLE FALSE) -else() - set(ASSIMP_PACKAGE_VERSION_COMPATIBLE TRUE) - if ("${ASSIMP_PACKAGE_VERSION}" VERSION_EQUAL "${ASSIMP_PACKAGE_FIND_VERSION}") - set(ASSIMP_PACKAGE_VERSION_EXACT TRUE) - endif() -endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 7072537f1..9baff4c40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,8 +132,8 @@ OPTION ( ASSIMP_IGNORE_GIT_HASH ) IF ( WIN32 ) - OPTION ( ASSIMP_BUILD_ASSIMP_VIEW - "If the Assimp view tool is built. (requires DirectX)" + OPTION ( ASSIMP_BUILD_ASSIMP_VIEW + "If the Assimp view tool is built. (requires DirectX)" OFF ) ENDIF() @@ -387,67 +387,52 @@ ELSE() SET(CMAKE_INSTALL_FULL_BINDIR ${CMAKE_INSTALL_PREFIX}/${ASSIMP_BIN_INSTALL_DIR}) ENDIF() +set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated") + IF(ASSIMP_HUNTER_ENABLED) set(CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}") - set(INCLUDE_INSTALL_DIR "include") - - set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated") - - # Configuration + set(CMAKE_CONFIG_TEMPLATE_FILE "cmake/assimp-hunter-config.cmake.in") + set(NAMESPACE "${PROJECT_NAME}::") + set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets") set(VERSION_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake") set(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}Config.cmake") - set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets") - set(NAMESPACE "${PROJECT_NAME}::") - - # Include module with fuction 'write_basic_package_version_file' - include(CMakePackageConfigHelpers) - - # Note: PROJECT_VERSION is used as a VERSION - write_basic_package_version_file("${VERSION_CONFIG}" COMPATIBILITY SameMajorVersion) - - # Use variables: - # * TARGETS_EXPORT_NAME - # * PROJECT_NAME - configure_package_config_file( - "cmake/assimp-hunter-config.cmake.in" - "${PROJECT_CONFIG}" - INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}" - ) - - install( - FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}" - DESTINATION "${CONFIG_INSTALL_DIR}" - ) - - install( - EXPORT "${TARGETS_EXPORT_NAME}" - NAMESPACE "${NAMESPACE}" - DESTINATION "${CONFIG_INSTALL_DIR}" - ) ELSE() - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" @ONLY IMMEDIATE) - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake" @ONLY IMMEDIATE) - IF (is_multi_config) - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-debug.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" @ONLY IMMEDIATE) - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-release.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake" @ONLY IMMEDIATE) - SET(PACKAGE_TARGETS_FILE "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake") - ELSEIF (CMAKE_BUILD_TYPE STREQUAL Debug) - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-debug.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake" @ONLY IMMEDIATE) - SET(PACKAGE_TARGETS_FILE "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-debug.cmake") - ELSE() - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimpTargets-release.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake" @ONLY IMMEDIATE) - SET(PACKAGE_TARGETS_FILE "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets-release.cmake") - ENDIF() - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/assimp-config-version.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" @ONLY IMMEDIATE) - #we should generated these scripts after CMake VERSION 3.0.2 using export(EXPORT ...) and write_basic_package_version_file(...) - INSTALL(FILES - "${CMAKE_CURRENT_BINARY_DIR}/assimp-config.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/assimp-config-version.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/assimpTargets.cmake" - ${PACKAGE_TARGETS_FILE} - DESTINATION "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" COMPONENT ${LIBASSIMP-DEV_COMPONENT}) + set(CONFIG_INSTALL_DIR "${ASSIMP_LIB_INSTALL_DIR}/cmake/assimp-${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}") + set(CMAKE_CONFIG_TEMPLATE_FILE "cmake/assimp-plain-config.cmake.in") + string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE) + set(NAMESPACE "${PROJECT_NAME_LOWERCASE}::") + set(TARGETS_EXPORT_NAME "${PROJECT_NAME_LOWERCASE}Targets") + set(VERSION_CONFIG "${GENERATED_DIR}/${PROJECT_NAME_LOWERCASE}ConfigVersion.cmake") + set(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME_LOWERCASE}Config.cmake") ENDIF() +set(INCLUDE_INSTALL_DIR "include") + +# Include module with fuction 'write_basic_package_version_file' +include(CMakePackageConfigHelpers) + +# Note: PROJECT_VERSION is used as a VERSION +write_basic_package_version_file("${VERSION_CONFIG}" COMPATIBILITY SameMajorVersion) + +configure_package_config_file( + ${CMAKE_CONFIG_TEMPLATE_FILE} + "${PROJECT_CONFIG}" + INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}" +) + +install( + FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}" + DESTINATION "${CONFIG_INSTALL_DIR}" + COMPONENT ${LIBASSIMP-DEV_COMPONENT} +) + +install( + EXPORT "${TARGETS_EXPORT_NAME}" + NAMESPACE "${NAMESPACE}" + DESTINATION "${CONFIG_INSTALL_DIR}" + COMPONENT ${LIBASSIMP-DEV_COMPONENT} +) + IF( ASSIMP_BUILD_DOCS ) ADD_SUBDIRECTORY(doc) ENDIF() diff --git a/assimp-config-version.cmake.in b/assimp-config-version.cmake.in deleted file mode 100644 index 68366820a..000000000 --- a/assimp-config-version.cmake.in +++ /dev/null @@ -1,48 +0,0 @@ -# Open Asset Import Library (assimp) -# ---------------------------------------------------------------------- -# Copyright (c) 2006-2020, assimp team -# All rights reserved. -# -# Redistribution and use of this software in source and binary forms, -# with or without modification, are permitted provided that the -# following conditions are met: -# -# * Redistributions of source code must retain the above -# copyright notice, this list of conditions and the -# following disclaimer. -# -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the -# following disclaimer in the documentation and/or other -# materials provided with the distribution. -# -# * Neither the name of the assimp team, nor the names of its -# contributors may be used to endorse or promote products -# derived from this software without specific prior -# written permission of the assimp team. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#---------------------------------------------------------------------- -set( PACKAGE_VERSION "@ASSIMP_VERSION@" ) -if( "${PACKAGE_FIND_VERSION}" VERSION_EQUAL "@ASSIMP_VERSION@") - set(PACKAGE_VERSION_EXACT 1) -endif() -if( "${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}" EQUAL "@ASSIMP_VERSION@" ) - set(PACKAGE_VERSION_COMPATIBLE 1) -elseif( "${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@ASSIMP_VERSION_MAJOR@" ) - # for now backward compatible if minor version is less - if( ${PACKAGE_FIND_VERSION_MINOR} LESS @ASSIMP_VERSION_MINOR@ ) - set(PACKAGE_VERSION_COMPATIBLE 1) - endif() -endif() -set( ASSIMP_STATIC_LIB "@ASSIMP_BUILD_STATIC_LIB@") diff --git a/assimp-config.cmake.in b/assimp-config.cmake.in deleted file mode 100644 index 0ab9fd071..000000000 --- a/assimp-config.cmake.in +++ /dev/null @@ -1 +0,0 @@ -include(${CMAKE_CURRENT_LIST_DIR}/assimpTargets.cmake) diff --git a/assimpTargets-debug.cmake.in b/assimpTargets-debug.cmake.in deleted file mode 100644 index b7efe71f9..000000000 --- a/assimpTargets-debug.cmake.in +++ /dev/null @@ -1,126 +0,0 @@ -#---------------------------------------------------------------- -# Generated CMake target import file for configuration "Debug". -#---------------------------------------------------------------- - -# Commands may need to know the format version. -set(CMAKE_IMPORT_FILE_VERSION 1) - -set(ASSIMP_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) - -get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - -if(MSVC) - if(MSVC_TOOLSET_VERSION) - set(MSVC_PREFIX "vc${MSVC_TOOLSET_VERSION}") - else() - if( MSVC70 OR MSVC71 ) - set(MSVC_PREFIX "vc70") - elseif( MSVC80 ) - set(MSVC_PREFIX "vc80") - elseif( MSVC90 ) - set(MSVC_PREFIX "vc90") - elseif( MSVC10 ) - set(MSVC_PREFIX "vc100") - elseif( MSVC11 ) - set(MSVC_PREFIX "vc110") - elseif( MSVC12 ) - set(MSVC_PREFIX "vc120") - elseif( MSVC_VERSION LESS 1910) - set(MSVC_PREFIX "vc140") - elseif( MSVC_VERSION LESS 1920) - set(MSVC_PREFIX "vc141") - elseif( MSVC_VERSION LESS 1930) - set(MSVC_PREFIX "vc142") - else() - set(MSVC_PREFIX "vc150") - endif() - endif() - set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" ) - - if(ASSIMP_BUILD_SHARED_LIBS) - set(sharedLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@") - set(importLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_IMPORT_LIBRARY_SUFFIX@") - - # Import target "assimp::assimp" for configuration "Debug" - set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(assimp::assimp PROPERTIES - IMPORTED_IMPLIB_DEBUG "@CMAKE_INSTALL_FULL_LIBDIR@/${importLibraryName}" - IMPORTED_LOCATION_DEBUG "@CMAKE_INSTALL_FULL_BINDIR@/${sharedLibraryName}" - ) - list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) - list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${importLibraryName}") - list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_BINDIR@/${sharedLibraryName}" ) - else() - set(staticLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_STATIC_LIBRARY_SUFFIX@") - - # Import target "assimp::assimp" for configuration "Debug" - set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(assimp::assimp PROPERTIES - IMPORTED_LOCATION_DEBUG "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}" - ) - list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) - list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}") - endif() - -else() - set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@" CACHE STRING "the suffix for the assimp libraries" ) - if(ASSIMP_BUILD_SHARED_LIBS) - if(WIN32) - # Handle MinGW compiler. - set(sharedLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@@CMAKE_STATIC_LIBRARY_SUFFIX@") - elseif(APPLE) - set(sharedLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@.@ASSIMP_VERSION_MAJOR@@CMAKE_SHARED_LIBRARY_SUFFIX@") - else() - set(sharedLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@.@ASSIMP_VERSION_MAJOR@") - endif() - - # Import target "assimp::assimp" for configuration "Debug" - set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(assimp::assimp PROPERTIES - IMPORTED_SONAME_DEBUG "${sharedLibraryName}" - IMPORTED_LOCATION_DEBUG "@CMAKE_INSTALL_FULL_LIBDIR@/${sharedLibraryName}" - ) - list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) - list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${sharedLibraryName}" ) - else() - set(staticLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_STATIC_LIBRARY_SUFFIX@") - - # Import target "assimp::assimp" for configuration "Debug" - set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(assimp::assimp PROPERTIES - IMPORTED_LOCATION_DEBUG "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}" - ) - list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) - list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}" ) - endif() -endif() - -# Commands beyond this point should not need to know the version. -set(CMAKE_IMPORT_FILE_VERSION) - -get_filename_component(ASSIMP_ROOT_DIR "@CMAKE_INSTALL_PREFIX@" REALPATH) -set( ASSIMP_CXX_FLAGS ) # dynamically linked library -set( ASSIMP_LINK_FLAGS "" ) -set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_LIB_INSTALL_DIR@") -set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_INCLUDE_INSTALL_DIR@") -if(ASSIMP_BUILD_SHARED_LIBS) - set( ASSIMP_LIBRARIES ${sharedLibraryName}) -else() - set( ASSIMP_LIBRARIES ${staticLibraryName}) -endif() - -# for compatibility with pkg-config -set(ASSIMP_CFLAGS_OTHER "${ASSIMP_CXX_FLAGS}") -set(ASSIMP_LDFLAGS_OTHER "${ASSIMP_LINK_FLAGS}") - -MARK_AS_ADVANCED( - ASSIMP_ROOT_DIR - ASSIMP_CXX_FLAGS - ASSIMP_LINK_FLAGS - ASSIMP_INCLUDE_DIRS - ASSIMP_LIBRARIES - ASSIMP_CFLAGS_OTHER - ASSIMP_LDFLAGS_OTHER - ASSIMP_LIBRARY_SUFFIX - ASSIMP_BUILD_SHARED_LIBS -) diff --git a/assimpTargets-release.cmake.in b/assimpTargets-release.cmake.in deleted file mode 100644 index c716006dd..000000000 --- a/assimpTargets-release.cmake.in +++ /dev/null @@ -1,127 +0,0 @@ -#---------------------------------------------------------------- -# Generated CMake target import file for configuration "Release". -#---------------------------------------------------------------- - -# Commands may need to know the format version. -set(CMAKE_IMPORT_FILE_VERSION 1) - -set(ASSIMP_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) - -get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) - -if(MSVC) - if(MSVC_TOOLSET_VERSION) - set(MSVC_PREFIX "vc${MSVC_TOOLSET_VERSION}") - else() - if( MSVC70 OR MSVC71 ) - set(MSVC_PREFIX "vc70") - elseif( MSVC80 ) - set(MSVC_PREFIX "vc80") - elseif( MSVC90 ) - set(MSVC_PREFIX "vc90") - elseif( MSVC10 ) - set(MSVC_PREFIX "vc100") - elseif( MSVC11 ) - set(MSVC_PREFIX "vc110") - elseif( MSVC12 ) - set(MSVC_PREFIX "vc120") - elseif( MSVC_VERSION LESS 1910) - set(MSVC_PREFIX "vc140") - elseif( MSVC_VERSION LESS 1920) - set(MSVC_PREFIX "vc141") - elseif( MSVC_VERSION LESS 1930) - set(MSVC_PREFIX "vc142") - else() - set(MSVC_PREFIX "vc150") - endif() - endif() - set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@-${MSVC_PREFIX}-mt" CACHE STRING "the suffix for the assimp windows library" ) - - if(ASSIMP_BUILD_SHARED_LIBS) - set(sharedLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_SHARED_LIBRARY_SUFFIX@") - set(importLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_IMPORT_LIBRARY_SUFFIX@") - - # Import target "assimp::assimp" for configuration "Release" - set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(assimp::assimp PROPERTIES - IMPORTED_IMPLIB_RELEASE "@CMAKE_INSTALL_FULL_LIBDIR@/${importLibraryName}" - IMPORTED_LOCATION_RELEASE "@CMAKE_INSTALL_FULL_BINDIR@/${sharedLibraryName}" - ) - list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) - list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${importLibraryName}") - list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_BINDIR@/${sharedLibraryName}" ) - else() - set(staticLibraryName "assimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_STATIC_LIBRARY_SUFFIX@") - - # Import target "assimp::assimp" for configuration "Release" - set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(assimp::assimp PROPERTIES - IMPORTED_LOCATION_RELEASE "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}" - ) - list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) - list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}") - endif() - -else() - set(ASSIMP_LIBRARY_SUFFIX "@ASSIMP_LIBRARY_SUFFIX@" CACHE STRING "the suffix for the assimp libraries" ) - if(ASSIMP_BUILD_SHARED_LIBS) - if(WIN32) - # Handle MinGW compiler. - set(sharedLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@@CMAKE_STATIC_LIBRARY_SUFFIX@") - elseif(APPLE) - set(sharedLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}.@ASSIMP_VERSION_MAJOR@@CMAKE_SHARED_LIBRARY_SUFFIX@") - else() - set(sharedLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_SHARED_LIBRARY_SUFFIX@.@ASSIMP_VERSION_MAJOR@") - endif() - - # Import target "assimp::assimp" for configuration "Release" - set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(assimp::assimp PROPERTIES - IMPORTED_SONAME_RELEASE "${sharedLibraryName}" - IMPORTED_LOCATION_RELEASE "@CMAKE_INSTALL_FULL_LIBDIR@/${sharedLibraryName}" - ) - list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) - list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${sharedLibraryName}" ) - else() - set(staticLibraryName "libassimp${ASSIMP_LIBRARY_SUFFIX}@CMAKE_STATIC_LIBRARY_SUFFIX@") - - # Import target "assimp::assimp" for configuration "Release" - set_property(TARGET assimp::assimp APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(assimp::assimp PROPERTIES - IMPORTED_LOCATION_RELEASE "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}" - ) - list(APPEND _IMPORT_CHECK_TARGETS assimp::assimp ) - list(APPEND _IMPORT_CHECK_FILES_FOR_assimp::assimp "@CMAKE_INSTALL_FULL_LIBDIR@/${staticLibraryName}" ) - endif() -endif() - -# Commands beyond this point should not need to know the version. -set(CMAKE_IMPORT_FILE_VERSION) - -get_filename_component(ASSIMP_ROOT_DIR "@CMAKE_INSTALL_PREFIX@" REALPATH) - -set( ASSIMP_CXX_FLAGS ) # dynamically linked library -set( ASSIMP_LINK_FLAGS "" ) -set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_LIB_INSTALL_DIR@") -set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_INCLUDE_INSTALL_DIR@") -if(ASSIMP_BUILD_SHARED_LIBS) - set( ASSIMP_LIBRARIES ${sharedLibraryName}) -else() - set( ASSIMP_LIBRARIES ${staticLibraryName}) -endif() - -# for compatibility with pkg-config -set(ASSIMP_CFLAGS_OTHER "${ASSIMP_CXX_FLAGS}") -set(ASSIMP_LDFLAGS_OTHER "${ASSIMP_LINK_FLAGS}") - -MARK_AS_ADVANCED( - ASSIMP_ROOT_DIR - ASSIMP_CXX_FLAGS - ASSIMP_LINK_FLAGS - ASSIMP_INCLUDE_DIRS - ASSIMP_LIBRARIES - ASSIMP_CFLAGS_OTHER - ASSIMP_LDFLAGS_OTHER - ASSIMP_LIBRARY_SUFFIX - ASSIMP_BUILD_SHARED_LIBS -) diff --git a/assimpTargets.cmake.in b/assimpTargets.cmake.in deleted file mode 100644 index 897d00217..000000000 --- a/assimpTargets.cmake.in +++ /dev/null @@ -1,91 +0,0 @@ -# Generated by CMake - -if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5) - message(FATAL_ERROR "CMake >= 2.6.0 required") -endif() -cmake_policy(PUSH) -cmake_policy(VERSION 2.6) -# Required for the evaluation of "if(@BUILD_SHARED_LIBS@)" below to function -cmake_policy(SET CMP0012 NEW) - -#---------------------------------------------------------------- -# Generated CMake target import file. -#---------------------------------------------------------------- - -# Commands may need to know the format version. -set(CMAKE_IMPORT_FILE_VERSION 1) - -# Protect against multiple inclusion, which would fail when already imported targets are added once more. -set(_targetsDefined) -set(_targetsNotDefined) -set(_expectedTargets) -foreach(_expectedTarget assimp::assimp) - list(APPEND _expectedTargets ${_expectedTarget}) - if(NOT TARGET ${_expectedTarget}) - list(APPEND _targetsNotDefined ${_expectedTarget}) - endif() - if(TARGET ${_expectedTarget}) - list(APPEND _targetsDefined ${_expectedTarget}) - endif() -endforeach() -if("${_targetsDefined}" STREQUAL "${_expectedTargets}") - unset(_targetsDefined) - unset(_targetsNotDefined) - unset(_expectedTargets) - set(CMAKE_IMPORT_FILE_VERSION) - cmake_policy(POP) - return() -endif() -if(NOT "${_targetsDefined}" STREQUAL "") - message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") -endif() -unset(_targetsDefined) -unset(_targetsNotDefined) -unset(_expectedTargets) - -# Create imported target assimp::assimp -add_library(assimp::assimp @BUILD_LIB_TYPE@ IMPORTED) - -set_target_properties(assimp::assimp PROPERTIES - COMPATIBLE_INTERFACE_STRING "assimp_MAJOR_VERSION" - INTERFACE_assimp_MAJOR_VERSION "1" - INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_FULL_INCLUDEDIR@" - #INTERFACE_LINK_LIBRARIES "TxtUtils::TxtUtils;MealyMachine::MealyMachine" -) - -if(CMAKE_VERSION VERSION_LESS 2.8.12) - message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.") -endif() - -# Load information for each installed configuration. -get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -file(GLOB CONFIG_FILES "${_DIR}/assimpTargets-*.cmake") -foreach(f ${CONFIG_FILES}) - include(${f}) -endforeach() - -# Loop over all imported files and verify that they actually exist -foreach(target ${_IMPORT_CHECK_TARGETS} ) - foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) - if(NOT EXISTS "${file}" ) - message(FATAL_ERROR "The imported target \"${target}\" references the file - \"${file}\" -but this file does not exist. Possible reasons include: -* The file was deleted, renamed, or moved to another location. -* An install or uninstall procedure did not complete successfully. -* The installation package was faulty and contained - \"${CMAKE_CURRENT_LIST_FILE}\" -but not all the files it references. -") - endif() - endforeach() - unset(_IMPORT_CHECK_FILES_FOR_${target}) -endforeach() -unset(_IMPORT_CHECK_TARGETS) - -# This file does not depend on other imported targets which have -# been exported from the same project but in a separate export set. - -# Commands beyond this point should not need to know the version. -set(CMAKE_IMPORT_FILE_VERSION) -cmake_policy(POP) diff --git a/cmake/assimp-plain-config.cmake.in b/cmake/assimp-plain-config.cmake.in new file mode 100644 index 000000000..6551dcb68 --- /dev/null +++ b/cmake/assimp-plain-config.cmake.in @@ -0,0 +1,9 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake") + +set(ASSIMP_ROOT_DIR ${PACKAGE_PREFIX_DIR}) +set(ASSIMP_LIBRARIES assimp::assimp) +set(ASSIMP_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) +get_property(ASSIMP_INCLUDE_DIRS TARGET assimp::assimp PROPERTY INTERFACE_INCLUDE_DIRECTORIES) +set(ASSIMP_LIBRARY_DIRS "") diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 5a4e2dafd..a0bad4e10 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1238,23 +1238,16 @@ IF (RT_FOUND AND ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC) TARGET_LINK_LIBRARIES(assimp ${RT_LIBRARY}) ENDIF () -IF(ASSIMP_HUNTER_ENABLED) - INSTALL( TARGETS assimp - EXPORT "${TARGETS_EXPORT_NAME}" - LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR} - ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR} - RUNTIME DESTINATION ${ASSIMP_BIN_INSTALL_DIR} - FRAMEWORK DESTINATION ${ASSIMP_LIB_INSTALL_DIR} - COMPONENT ${LIBASSIMP_COMPONENT} - INCLUDES DESTINATION "include") -ELSE() + INSTALL( TARGETS assimp - LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR} - ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR} - RUNTIME DESTINATION ${ASSIMP_BIN_INSTALL_DIR} - FRAMEWORK DESTINATION ${ASSIMP_LIB_INSTALL_DIR} - COMPONENT ${LIBASSIMP_COMPONENT}) -ENDIF() + EXPORT "${TARGETS_EXPORT_NAME}" + LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR} + RUNTIME DESTINATION ${ASSIMP_BIN_INSTALL_DIR} + FRAMEWORK DESTINATION ${ASSIMP_LIB_INSTALL_DIR} + COMPONENT ${LIBASSIMP_COMPONENT} + INCLUDES DESTINATION include +) INSTALL( FILES ${PUBLIC_HEADERS} DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}/assimp COMPONENT assimp-dev) INSTALL( FILES ${COMPILER_HEADERS} DESTINATION ${ASSIMP_INCLUDE_INSTALL_DIR}/assimp/Compiler COMPONENT assimp-dev) diff --git a/contrib/zlib/CMakeLists.txt b/contrib/zlib/CMakeLists.txt index 664c83a71..c284656eb 100644 --- a/contrib/zlib/CMakeLists.txt +++ b/contrib/zlib/CMakeLists.txt @@ -199,6 +199,7 @@ endif(MINGW) add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) INSTALL( TARGETS zlibstatic + EXPORT "${TARGETS_EXPORT_NAME}" LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR} ARCHIVE DESTINATION ${ASSIMP_LIB_INSTALL_DIR} RUNTIME DESTINATION ${ASSIMP_BIN_INSTALL_DIR}