Skip to content

Commit

Permalink
Fixed infinite loop in aikidoConfig.cmake file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Koval committed Jul 21, 2016
1 parent 6291ea9 commit c4c2274
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions cmake/aikidoConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ function(aikido_traverse_components output_variable)
set(output_components)

foreach(component ${ARGN})
get_property(is_found DIRECTORY
PROPERTY "aikido_${component}_FOUND" DEFINED)

if(NOT is_found)
# We should be able to elminate the <C>_VISITED property by detecting
# whether the <C>_FOUND property is DEFINED. Unfortunately, DEFINED checks
# whether or not define_property() was called, not whether the variable was
# set. The exact behavior seems to vary between CMake versions, so we use
# an extra variable instead.
get_property(is_visited DIRECTORY PROPERTY "aikido_${component}_VISITED")
set_property(DIRECTORY PROPERTY "aikido_${component}_VISITED" TRUE)

if(NOT is_visited)
set(component_include
"${CMAKE_CURRENT_LIST_DIR}/aikido_${component}Component.cmake")
set(target_include
Expand Down Expand Up @@ -50,9 +55,9 @@ function(aikido_traverse_components output_variable)
endforeach()

list(APPEND output_components "${component}")
else()
set_property(DIRECTORY PROPERTY "aikido_${component}_FOUND" FALSE)

This comment has been minimized.

Copy link
@psigen

psigen Jul 21, 2016

Member

Couldn't we just always do both define_ and set_property?

define_property(GLOBAL PROPERTY "aikido_${component}_FOUND")
set_property(GLOBAL PROPERTY "aikido_${component}_FOUND" FALSE)
endif()
else()
set_property(DIRECTORY PROPERTY "aikido_${component}_FOUND" FALSE)
endif()
endforeach()

Expand Down Expand Up @@ -82,7 +87,7 @@ function(aikido_package_init)
foreach(component ${ARGN})
aikido_export_property("aikido_${component}_FOUND")

if(${aikido_${component}_FOUND})
if("aikido_${component}_FOUND")
aikido_export_property("aikido_${component}_INCLUDE_DIRS")
aikido_export_property("aikido_${component}_DEFINITIONS")
aikido_export_property("aikido_${component}_LIBRARIES")
Expand Down

0 comments on commit c4c2274

Please sign in to comment.