Commit 010c5959 authored by Brad King's avatar Brad King

Tests: Add case for add_subdirectory inside a function

parent 29c13856
-- var='1' before my_add_subdirectory
-- var='2' in my_add_subdirectory before add_subdirectory
-- var='2' in subdirectory before set
-- var='3' in subdirectory after set
-- var_sub='' in subdirectory after set PARENT_SCOPE
-- var='2' in my_add_subdirectory after add_subdirectory
-- var_sub='sub' in my_add_subdirectory after add_subdirectory
-- var='1' after my_add_subdirectory
-- var_sub='' after my_add_subdirectory
-- var='3' taken from subdirectory
function(my_add_subdirectory dir)
set(var 2)
message(STATUS "var='${var}' in my_add_subdirectory before add_subdirectory")
message(STATUS "var='${var}' in my_add_subdirectory after add_subdirectory")
message(STATUS "var_sub='${var_sub}' in my_add_subdirectory after add_subdirectory")
set(var 1)
message(STATUS "var='${var}' before my_add_subdirectory")
message(STATUS "var='${var}' after my_add_subdirectory")
message(STATUS "var_sub='${var_sub}' after my_add_subdirectory")
get_directory_property(sub_var DIRECTORY Function DEFINITION var)
message(STATUS "var='${sub_var}' taken from subdirectory")
message(STATUS "var='${var}' in subdirectory before set")
set(var 3)
message(STATUS "var='${var}' in subdirectory after set")
set(var_sub sub PARENT_SCOPE)
message(STATUS "var_sub='${var_sub}' in subdirectory after set PARENT_SCOPE")
......@@ -2,3 +2,4 @@ include(RunCMake)
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