How do I set the CMAKE_INCLUDE_PATH? Also...
How to I set the CMAKE_LIBRARY_PATH?

All i know about CMAKE is that is is a GUI with very limited options. Where do I put these variables and why do I set them? How do I set them?


Recommended Answers

All 2 Replies

First, these are environment variables. So, if you need to set them, set them like you do with any other environment variable.

Second, why do you want to modify those variables? These are not things that you normally have to temper with, i.e., these are usually set correctly at installation of cmake, and they relate to how cmake functions overall, these are not variables you need to temper with for individual projects. The CMAKE_INCLUDE_PATH defines the different system's paths in which the CMake program (not the compiler) will look when it is instructed to look for a particular set of header files corresponding to a package required by your source code, i.e., when issuing a find_path() command in a CMakeLists.txt file. Similarly, the CMAKE_LIBRARY_PATH defines where to look for when CMake tries to find an installation of a required external library, i.e., when issuing a find_library() command in a CMakeLists.txt file. Normally, these environment variables are basically set to the few system paths in which such packages (headers and libraries) would normally be found. If you happen to install some libraries in very weird places (why would you do that?), then you might have to add these very weird places to these environment variables. But that's not something you should do anyways.

These variables are not those corresponding to "include paths" or "library paths" typically found in the build configurations of IDEs. CMake is made to automatically search for the required include paths, library paths, and libraries to link to, per request in the CMakeLists.txt files. Look at the find_package() command and commands such as include_directories() and target_link_libraries().

All i know about CMAKE is that is is a GUI with very limited options.

CMake is not a GUI. It comes with a crappy GUI that is basically useless except for setting a few high-level options. CMake is a build-system that reads a bunch of files, named "CMakeLists.txt", that you create and maintain in your source code directory. These files give instructions to the CMake program as to how to build the source code: which source files to compile into what targets (executables, libraries), which external libraries are required for the different targets, how to link them, how to find them, etc., and a whole set of other things that CMake can do. Basically, the instructions found in the CMakeLists.txt are essentially a script, which CMake executes to build your project. The nice thing with CMake, as opposed to another script or build-system, is that it does a lot of things for you and in a platform-independent way.

What is it that you are trying to accomplish? Have you gone through any cmake tutorial?

OK, thanks. Are you suggesting that the CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH variables should have been set automatically? I can actually vary the errors I get if I put these into the environmental variables myself but in no part of that setup is there a reference to the paths which need to be searched.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.