Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
Signed-off-by: Rémi Achard <[email protected]>
  • Loading branch information
remia committed Nov 16, 2023
1 parent acaf8ad commit 4ae89a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion share/cmake/macros/ocio_handle_dependency.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ macro (ocio_handle_dependency dep_name)
endif()
if(ocio_dep_REQUIRED)
if(NOT ${dep_name}_FOUND AND NOT ocio_dep_VERSION)
if(NOT ${dep_name}_FOUND)
message(SEND_ERROR "${ColorError}${dep_name} is required, will abort at the end.${ColorReset}")
endif()
endif()
Expand Down
23 changes: 16 additions & 7 deletions share/cmake/modules/Findyaml-cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,33 @@ if(yaml-cpp_FIND_QUIETLY)
endif()

if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
set(_yaml-cpp_REQUIRED_VARS yaml-cpp_LIBRARY)

# Search for yaml-cpp-config.cmake
if(NOT DEFINED yaml-cpp_ROOT)
message(STATUS "Looking for yaml-cpp-config.cmake")
find_package(yaml-cpp ${yaml-cpp_FIND_VERSION} CONFIG ${quiet})
endif()

if(yaml-cpp_FOUND)
message(STATUS "Found yaml-cpp-config.cmake")

# Alias target for yaml-cpp < 0.8 compatibility
if(TARGET yaml-cpp AND NOT TARGET yaml-cpp::yaml-cpp)
message(STATUS "Creating alias target yaml-cpp::yaml-cpp")
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
endif()

set(yaml-cpp_INCLUDE_DIR ${YAML_CPP_INCLUDE_DIR})
get_target_property(yaml-cpp_INCLUDE_DIR yaml-cpp::yaml-cpp INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(yaml-cpp_LIBRARY yaml-cpp::yaml-cpp LOCATION)
else()
message(STATUS "Didn't find yaml-cpp-config.cmake")

# As yaml-cpp-config.cmake search fails, search an installed library
# using yaml-cpp.pc .

list(APPEND _yaml-cpp_REQUIRED_VARS yaml-cpp_INCLUDE_DIR yaml-cpp_VERSION)

# Search for yaml-cpp.pc
find_package(PkgConfig ${quiet})
pkg_check_modules(PC_yaml-cpp ${quiet} "yaml-cpp>=${yaml-cpp_FIND_VERSION}")
Expand Down Expand Up @@ -124,21 +132,20 @@ if(NOT OCIO_INSTALL_EXT_PACKAGES STREQUAL ALL)
if(PC_yaml-cpp_FOUND)
set(yaml-cpp_VERSION "${PC_yaml-cpp_VERSION}")
endif()

message(STATUS "PKG Config found: ${PC_yaml-cpp_FOUND}")

endif()

# Override REQUIRED if package can be installed
if(OCIO_INSTALL_EXT_PACKAGES STREQUAL MISSING)
set(yaml-cpp_FIND_REQUIRED FALSE)
endif()

set(YAML_CPP_INCLUDE_DIR "${yaml-cpp_INCLUDE_DIR}")

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(yaml-cpp
REQUIRED_VARS
yaml-cpp_LIBRARY
yaml-cpp_INCLUDE_DIR
yaml-cpp_VERSION
${_yaml-cpp_REQUIRED_VARS}
VERSION_VAR
yaml-cpp_VERSION
)
Expand All @@ -150,6 +157,7 @@ endif()
### Create target

if (yaml-cpp_FOUND AND NOT TARGET yaml-cpp::yaml-cpp)
message(STATUS "Create target now that yaml-cpp is found")
add_library(yaml-cpp::yaml-cpp UNKNOWN IMPORTED GLOBAL)
set_target_properties(yaml-cpp::yaml-cpp PROPERTIES
IMPORTED_LOCATION ${yaml-cpp_LIBRARY}
Expand All @@ -168,5 +176,6 @@ endif ()
if (yaml-cpp_FOUND)
# TODO: Remove this variable and use the `yaml-cpp::yaml-cpp` target
# directly when the minimum version of yaml-cpp is updated to 0.8.
get_target_property(YAML_CPP_INCLUDE_DIR yaml-cpp::yaml-cpp INCLUDE_DIRECTORIES)
set(YAML_CPP_LIBRARIES yaml-cpp::yaml-cpp)
endif()
endif ()

0 comments on commit 4ae89a9

Please sign in to comment.