Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Passing CMake options to dependent "existing" module CMake #556
I have a small executable project that has a dependent module that is actually a CMake project of its own.
Yotta does well understanding that it is an "existing" CMake project and building it.
But I need to configure the CMake options of the dependent module from the executable project, I could not find a way to pass -DFEATURE=X type CMake defines into the dependent module.
Does this exist or must the dependent module CMakeLists.txt be hacked... it's a bit yucky when the preexisting library also builds for other platforms using CMake options.
You could put your module inside a directory with its own CMakeLists.txt file, which sets the options and then calls add_subdirectory on the existing module:
Is it a module you would wrap up for other people to use?
When modifying the existing CMakeLists.txt you could guard the defaults you want to set when building for yotta in tests for the version definition for your module that yotta will define: