by default, those variables carry the value -notfound. Directory scope: Each of the subdirectories in a. I am afraid that this can change from app to app in respect to which module I need or in respect of the dependecies tree in the modules itself so I'm looking for a cleaner solution. the found paths to those libraries are stored in special variables in cmake. Variables Function scope: Variables that are set inside a function are only visible inside the function. So I have tried to add it in some module that I think could be nested and hidden in some dependencies but compiling all the application I suddenly faced with: CMake Warning (dev) at /path_to_repo/cmake/FindFooX.cmake:6 (set):Ĭannot set "LIB": current scope has no parent. For bypass this I have to add PARENT_SCOPE in the set). After the installation, set the environment variable OPENSSLDIR to the installation. not relevant for high-end IDEs like Visual Studio. Build OpenSSL with CMake on Linux, MacOS, Win32, Win64 - GitHub. So in one of the final applications that uses some modules I can just do: target_link_libraries($/include)īut it happened sometimes that some module require another modules so that the add_subdirectory creates new scopes and can correctly load LIB but cannot write it (when I use set it is in the deeper scope and not changes the upper scope). only relevant for single configuration builds, as makefiles. If the cache entry does not exist prior to the call or the FORCE option is given then the cache entry will be set to the given value. Use the FORCE option to overwrite existing entries. You can use toolchain environment scripts to set CMake variables from a file. I have a cmake project in which I have some modules and I'm using Find-*.cmake for including the shared modules in the application.įor not taking in account every module that I add, I have defined a kind of global LIB variables tor the linker: # inside a Find-*.cmake or in the CMakeLists.txt of the modules: Since cache entries are meant to provide user-settable values this does not overwrite existing cache entries by default. These are the variables defined by the selected toolset (for example, vcvarsall.bat for MSVC or path variables like mingw/bin), or the variables from an environment initialization script.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |