Suppose I have a directory structure as follows:
/main.cpp /CMakeLists.txt /foo/foo.cpp /foo/CMakeLists.txt where my /CMakeLists.txt file contains the following:
project(Test) add_subdirectory("foo") add_executable(Test main.cpp foo/foo.cpp) target_link_libraries(Test ${OpenNI_LIB}) and my /foo/CMakeLists.txt file contains the following:
find_library(OpenNI REQUIRED) When I use the line add_subdirectory("foo") in the first CMakeLists.txt, what actually happens? Does it search for a second CMakeLists.txt file in foo, and add the contents to the first? Will any variables defined the second file be available in the first? And specifically in this example, will the variable ${OpenNI_LIB} be recognised in the first, given that it is defined in the second?
Thanks.