I have two separate git projects that I build using cmake
.
Project_A
|CMakeLists_A.txt
|foo.H
In the CMakeLists_A.txt
file, I define a variable that points to foo.H
as follows:
set(var_projectA ${CMAKE_CURRENT_SOURCE_DIR}/foo.H)
I add Project A as a subdirectory in Project B, which has the following structure:
Project B
|CMakeLists_B.txt
|Subdirectory_B
|CMakeLists_subB.txt
|test.cpp
In CMakeLists_B.txt
, I have:
add_subdirectory(${CMAKE_SOURCE_DIR}/extern/Project_A)
How can I access the variable var_projectA
in the subdirectory of Project B (i.e., in CMakeLists_subB.txt
)?