#[=======================================================================[ FindExchange.cmake ---------------- CMake module to find Exchange libraries and include directories. Usage ----- find_package(Exchange) Variables --------- Exchange_FOUND: Boolean indicating if Exchange was found Exchange_INCLUDE_DIRS: List of include directories Exchange_LIBRARIES: List of libraries Exchange_LIBRARY_PATH: Path of Exchange_LIBRARY without the filename Author ------ TechSoft3D #]=======================================================================] if(TARGET A3DLIBS) # A3DLIBS is already defined in project set(Exchange_FOUND TRUE) set(Exchange_INCLUDE_DIRS "") set(Exchange_LIBRARIES A3DLIBS) # Nom de la cible message(STATUS "A3DLIBS target found") # Set the variable to contain the path of Exchange_LIBRARY without the filename set(Exchange_LIBRARY_PATH ./) else() # Include interface targets include(${CMAKE_CURRENT_LIST_DIR}/hoops_unicode.cmake) # Include for variable binaries_folder_name include(${CMAKE_CURRENT_LIST_DIR}/binaries_folder_name.cmake) # Find Exchange find_path(Exchange_INCLUDE_DIR NAMES "A3DSDK.h" PATHS "${A3DLIBS_ROOT}/include" "$ENV{A3DLIBS_ROOT}/include" "${CMAKE_SOURCE_DIR}/../include" ) # add dynamic library suffix for Windows if (WIN32) set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .dll) endif() # find library with priority of A3DLIBS_ROOT cmake variable before env variable A3DLIBS_ROOT and then source directory find_library(Exchange_LIBRARY NAMES "A3DLIBS" PATHS "${A3DLIBS_ROOT}/bin/${binaries_folder_name}" "$ENV{A3DLIBS_ROOT}/bin/${binaries_folder_name}" "${CMAKE_SOURCE_DIR}/../bin/${binaries_folder_name}" ) # Set the variable to contain the path of Exchange_LIBRARY without the filename get_filename_component(Exchange_LIBRARY_PATH ${Exchange_LIBRARY} DIRECTORY) message(STATUS "Exchange_LIBRARY_PATH: ${Exchange_LIBRARY_PATH}") if(Exchange_INCLUDE_DIR AND Exchange_LIBRARY) set(Exchange_FOUND TRUE) set(Exchange_INCLUDE_DIRS ${Exchange_INCLUDE_DIR}) set(Exchange_LIBRARIES ${Exchange_LIBRARY}) message(STATUS "Exchange found at ${Exchange_INCLUDE_DIR}, ${Exchange_LIBRARY}") add_library(A3DLIBS SHARED IMPORTED) set_target_properties(A3DLIBS PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Exchange_INCLUDE_DIR}") set_property(TARGET A3DLIBS APPEND PROPERTY IMPORTED_LOCATION "${Exchange_LIBRARY}") add_library(A3DLIBS::Interface INTERFACE IMPORTED) set_target_properties(A3DLIBS::Interface PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Exchange_INCLUDE_DIR}") set_property(TARGET A3DLIBS::Interface APPEND PROPERTY IMPORTED_LOCATION "${Exchange_LIBRARY}") else() set(Exchange_FOUND FALSE) if(Exchange_FIND_REQUIRED) message(FATAL_ERROR "Exchange not found (required): ${Exchange_INCLUDE_DIR}, ${Exchange_LIBRARY}; set A3DLIBS_ROOT variable") else() message(WARNING "Exchange not found: ${Exchange_INCLUDE_DIR}, ${Exchange_LIBRARY}; set A3DLIBS_ROOT variable") endif() endif() endif() # Mark variables as advanced to avoid displaying them in the CMake user interface mark_as_advanced(Exchange_INCLUDE_DIR Exchange_LIBRARY)