[CMake] problem in merging "modern" and "non-modern" CMake code

Crni Gorac cgorac at gmail.com
Fri Jun 15 16:20:37 EDT 2018


I have a project, consisting of a library and a program, that is built
using CMake, with CMake files written using "modern" CMake.  For
adding functionality, I have to use another library from my library.
This additional library has to be included as source code in my
project, and I put it into a sub-directory of my library source code
directory.  It is also built using CMake, but its CMake files are
written using "non-modern" CMake.  If I just do:
    add_subdirectory(additional_library_directory)
from CMakeLists.txt in my library directory, it seems that it could
work, but the problem is that this additional library is using
add_definitions(), changing CMAKE_C_FLAGS, and doing other nasty
stuff, that is later affecting build of my library.  Thus, my
questions is: is there any way to sanitize behavior of "non-modern"
CMake code in alike situation, and use this additional library as I
desribed?

Thanks.


More information about the CMake mailing list