Commit 3702fd4d authored by Dominik Charousset's avatar Dominik Charousset

Update FindCAF CMake script

parent 50403ea0
...@@ -36,7 +36,9 @@ foreach (comp ${CAF_FIND_COMPONENTS}) ...@@ -36,7 +36,9 @@ foreach (comp ${CAF_FIND_COMPONENTS})
if (CAF_ROOT_DIR) if (CAF_ROOT_DIR)
set(header_hints set(header_hints
"${CAF_ROOT_DIR}/include" "${CAF_ROOT_DIR}/include"
"${CAF_ROOT_DIR}/../libcaf_${comp}") "${CAF_ROOT_DIR}/libcaf_${comp}"
"${CAF_ROOT_DIR}/../libcaf_${comp}"
"${CAF_ROOT_DIR}/../../libcaf_${comp}")
endif () endif ()
find_path(CAF_INCLUDE_DIR_${UPPERCOMP} find_path(CAF_INCLUDE_DIR_${UPPERCOMP}
NAMES NAMES
...@@ -51,18 +53,28 @@ foreach (comp ${CAF_FIND_COMPONENTS}) ...@@ -51,18 +53,28 @@ foreach (comp ${CAF_FIND_COMPONENTS})
mark_as_advanced(CAF_INCLUDE_DIR_${UPPERCOMP}) mark_as_advanced(CAF_INCLUDE_DIR_${UPPERCOMP})
if (NOT "${CAF_INCLUDE_DIR_${UPPERCOMP}}" if (NOT "${CAF_INCLUDE_DIR_${UPPERCOMP}}"
STREQUAL "CAF_INCLUDE_DIR_${UPPERCOMP}-NOTFOUND") STREQUAL "CAF_INCLUDE_DIR_${UPPERCOMP}-NOTFOUND")
# mark as found (set back to false in case library cannot be found) # mark as found (set back to false when missing library or build header)
set(CAF_${comp}_FOUND true) set(CAF_${comp}_FOUND true)
# add to CAF_INCLUDE_DIRS only if path isn't already set # check for CMake-generated build header for the core component
set(duplicate false) if ("${comp}" STREQUAL "core")
foreach (p ${CAF_INCLUDE_DIRS}) find_path(caf_build_header_path
if (${p} STREQUAL ${CAF_INCLUDE_DIR_${UPPERCOMP}}) NAMES
set(duplicate true) caf/detail/build_config.hpp
endif () HINTS
endforeach () ${header_hints}
if (NOT duplicate) /usr/include
set(CAF_INCLUDE_DIRS ${CAF_INCLUDE_DIRS} ${CAF_INCLUDE_DIR_${UPPERCOMP}}) /usr/local/include
/opt/local/include
/sw/include
${CMAKE_INSTALL_PREFIX}/include)
if ("${caf_build_header_path}" STREQUAL "caf_build_header_path-NOTFOUND")
message(WARNING "Found all.hpp for CAF core, but not build_config.hpp")
set(CAF_${comp}_FOUND false)
else()
list(APPEND CAF_INCLUDE_DIRS "${caf_build_header_path}")
endif()
endif() endif()
list(APPEND CAF_INCLUDE_DIRS "${CAF_INCLUDE_DIR_${UPPERCOMP}}")
# look for (.dll|.so|.dylib) file, again giving hints for non-installed CAFs # look for (.dll|.so|.dylib) file, again giving hints for non-installed CAFs
# skip probe_event as it is header only # skip probe_event as it is header only
if (NOT ${comp} STREQUAL "probe_event" AND NOT ${comp} STREQUAL "test") if (NOT ${comp} STREQUAL "probe_event" AND NOT ${comp} STREQUAL "test")
...@@ -90,6 +102,8 @@ foreach (comp ${CAF_FIND_COMPONENTS}) ...@@ -90,6 +102,8 @@ foreach (comp ${CAF_FIND_COMPONENTS})
endif () endif ()
endforeach () endforeach ()
list(REMOVE_DUPLICATES CAF_INCLUDE_DIRS)
# let CMake check whether all requested components have been found # let CMake check whether all requested components have been found
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CAF find_package_handle_standard_args(CAF
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment