
If you have previously tested tested out the library as a part of this tutorial, it should be already deployed to /tmp/MyLibraryDemo. This happens because the libraries imported from packages are assumed to be already installed on the target in a directory where the application can find them.Now CMake will find the package and build the project, however running it will result in an error: the libCMakeLibraryDemo.so file will not be found:.You can fix this by adding “c:\Packages\DemoLibrar圜lient” to the “Extra module directories” field on the CMake Project Settings page of VisualGDB Project Properties for your project:.If you try building it now, CMake will complain that FindCMakeLibraryDemo.cmake file must be located in CMAKE_MODULE_PATH: Insert the following line in the CMakeLists.txt file of the new project:įind_package ( CMakeLibraryDemo REQUIRED ).

Use the VisualGDB Linux Project Wizard to do that: CMake is the entry tool to configuring, compiling and building your project. Now we will create another CMake project that will import the package.
#UNDERSTANDING CMAKE LINUX INSTALL#

With CMake, you will need to findpackage() to reference the libraries in your. You can generate the package by right-clicking on libCMakeLibraryDemo.so in Solution Explorer and selecting “Install Target(s)”: vcpkg C/C++ getting started tutorial for Windows, macOS, and Linux.Kitware also provides online and onsite CMake trainings. This syntax tells CMake to use a directory inside the source tree when building the package and use the directory under the installation directory (where we installed PublicHeader.h using INSTALL FILES command) while handling exporting. The CMake Tutorial is now available as the CMake Tutorial Guide in the official documentation.
