Using Ubuntu, C++and cmakeI want to create a program Alphathat is based on the code for other programs Beta. I already have the source code for Beta, and I need to write code for Alphathat uses this existing code. I try to keep everything in order, so I have a separate directory for Alphaboth the Betasource files Alpha.cppand Beta.cpp.
Here is my directory structure:
/CMakeLists.txt
/Alpha.cpp (the main function)
/Beta
/CMakeLists.txt
/Beta.cpp
My CMakeLists.txtfile for Alphalooks like this:
cmake_minimum_required(VERSION 2.8)
project(Alpha)
add_executable(Alpha Alpha.cpp Beta/Beta.cpp)
Now, in the source code for Beta, the file CMakeLists.txtcontains a lot of information, such as checking the operating system, searching for packages and, as a rule, defining various cmake variables. I need to use these variables in the file CMakeLists.txtfor Alpha, so that Beta.cppcompiled correctly.
So my question is: is it possible to save all this information in Beta/CmakeLists.txtwithout writing it all to a file Alpha CMakeLists.txt? How do I transfer a file Alpha CMakeLists.txtto read a file Beta CMakeLists.txtto get these variables? I want to do this in order to keep everything neat and maintain modularity. Thank!
source
share