Cmake Link Library Dependencies

The project does not have to specify any of these dependencies, CMake automatically recognises and defines them. See also CMAKE_SYSTEM_LIBRARY_PATH and CMAKE_PREFIX_PATH. The following tables list all these dependencies on a per module/per plugin base. My slides are available here and the sequence of them is reflected in this post. First, CMake checks system platform and compilation toolset. Our CMake configuration will then automatically link the corresponding Debug or Release GTSAM library to your project, depending on which configuration your project is compiled in. This tutorial will explain how to use PDAL in your own projects using CMake. The details about cmake are out of the scope of this tutorial. CMake provides solutions to all those problems, but they all depend on defining a proper dependency tree for all libraries and executables with target_link_libraries(), so that’s the first thing to get right. CMake link shared library. txt - Uses MacroLoadPackage. @@ -12,7 +12,7 @@ SET(CMAKE_SKIP_RPATH:BOOL OFF) # Include base dir, so other files can refer to the generated files. The library is only shared between a handful of projects and is rather small, so I would really like to build it before it is linked. txt file if it is a normal fbgen-generated project for global or at the end of projectDef. Cmake__link_library_file_flag. I am developing my own header-only library that I want to use as a framework in other software. All our programs are developed in C++, therefore working knowledge of C++ programming and the C++ compilation pipeline is required (command line or IDE) for this tutorial. The project does not have to specify any of these dependencies, CMake automatically recognises and defines them. I went back to 0. I love cmake, but unfortunately its documentation is more focused on completeness than on providing hands-on-examples. library CMake target_link_libraries Interface Dependencies cmake interface library (1) If you are creating a shared library and your source cpp files #include the headers of another library (Say, QtNetwork for example), but your header files don't include QtNetwork headers, then QtNetwork is a PRIVATE dependency. You should see a. In this blog post I will describe the necessary steps to use SDL2 with CMake on both Linux (Ubuntu 17. Also cmake converter tries to read info about used NuGet packages and makes stubs for using it with use_package function. About C++ library dependencies. 42]) target_link_libraries(my_target PUBLIC dependency_target) # for a proper library this also setups any required include directories or other compilation options The hard way. 1 target_link_libraries(foobar 2 PUBLIC my::foo 3 PRIVATE my::bar 4 ) 30 32. Link dependencies between modules are solved using the TARGET_LINK_LIBRARIES command. This can get quite complex quite fast, CMake has many options. Once you have a GCC toolchain, configure your build of LLVM to use the new toolchain for your host compiler and C++ standard library. * CUDA driver series has a critical performance issue: do not use it. We gather the list of dependencies and outputs at build configuration time only, so if the generator changes and adds more dependencies, the build files won't know it. txt src/ CMakeLists. PUBLIC Used for this target and all targets that link against it. You will learn to use CMake's command-line tools and master modern CMake practices for configuring, building, and testing binaries and libraries. This tutorial shows various ways to use CMake's target_link_libraries() statement and explains the differences between them. Cheers Matt. CMake has a module called ExternalProject that can do this for you. cmake是Linux(这里默认是Ubuntu系统)下常使用的编译C++的工具,而使用cmake就需要先在CmakeLists. so), also called a shared library, and as a static link library (. See Building using CMake - Windows. The SYSTEM turns the include directory into a system include directory. Cmake provides the variable CMAKE_DL_LIBS that is intended to contain the platform-appropriate libraries. Vcpkg is package management system based CMake that manages libraries for Visual C++. 1 target_link_libraries(foobar 2 PUBLIC my::foo 3 PRIVATE my::bar 4 ) 30 32. One nice feature of this is that you don't waste time processing macros you don't use (unlike a usual cmake module). The compromise favored by Linux packagers is to use the subproject as a fallback for the external dependency. It is redundant to use add_dependencies(a b) to (re)specify the dependency. A library target name: The generated link line will have the full path to the linkable library file associated with the target. The file will contain a number of SET commands that. A build dependency for running cmake to build a native library. cmake provides a list of libraries names, it's up to the user to find them -> very inconvenient 2. That's not our case of course since we are trying to build both variants, hence library designed to be used as static or shared. Generators. Using CMake to statically link to a library outside of the project (2) I would like to use CMake to link my project to my shared library. But not every CMake project supports find_package(). You should see a. Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. The flag will be used before a library file path is given to the linker. Mingw64: add a statically linked library adds libstdc++ dependency. Compiling cpp samples on Mac. As I told you in this other thread, the CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH are environment variables, and they contain a list of paths that cmake ought to use in order to find the libraries on your system. There is no binary library to link to, and no configured header file. This tutorial will guide you through the process of creating and developing a simple CMake project. Warning! The 331. Documentation mentions that they can be used to specify both the link dependencies and the link interface in one command. All activated libraries are to be built after configuration. First off all, we need boost, as we use optional. So, inside the the foo-library's folder, we create a fooConfig. The preferred way to install dependencies under Linux is now to use the Static Linking Each Library: so that CMake will try to make blender link against. That's not our case of course since we are trying to build both variants, hence library designed to be used as static or shared. Adding Boost as a Dependency with CMake. By default it is the same as CMAKE_INSTALL_PREFIX, except on macOS where it defaults to "/Library/Frameworks", because dependencies on macOS are provided as frameworks. Dependencies. Calling this method makes writing the package() method for recipies easier. Adding Additional libraries. txt, then b. During configuration, you can select the libraries that you would like to build by setting a CMake variable of the form WITH_. Library ‘targets’ in CMake keep track of associated include paths, dependent libraries, compile flags, and even extra source files, using ‘target properties’. cpp) find_package(MiniSat 2. There are many Cmake tutorials available on internet. Flag to be used to link a library into a shared library or executable. The library is only shared between a handful of projects and is rather small, so I would really like to build it before it is linked. This document is designed to allow you to get the Abseil development environment up and running using CMake. The next part in the series will comprise of a CMake example using Qt and how a library can be exported using modern methodologies. gaudi_add_library(Lib1 src/lib1/*. I went throught the docs, but was not able to find the dolution in a reasonable time so far. I tried to use vcproj2cmake but it overly complicates to CMake file so I only took some of the stuff in it, I also added ideas from related questions and answers. GCC, the GNU Compiler Collection. cmake The enclosed python script will download and install cmake. This reliance on commodity exports makes Russia vulnerable to boom and bust cycles that follow the highly volatile swings in global commodity prices. We can then chain targets:. cmake finds the dependencies and provides full paths -> what if user wants to use its own version of a library? 3. sln) as a "source" since it involves adding/removing source files, modifying library dependencies, setting build dependencies etc. a" does not denote a target but a path, i. My slides are available here and the sequence of them is reflected in this post. First one obvious caveat -- extra libraries should be avoided if possible. In the above, we only explicitly link appA against the static library foo. This tutorial will explain how to use PDAL in your own projects using CMake. Hence a dependency on something in a subdirectory requires both a dependency on a file and on a target. There are a few options: AUTO: try to find package in the system default locations and build from source if not found. cpp ) add_library(constants SHARED libs/constants. LLVM_ENABLE_LLD:BOOL This option is equivalent to -DLLVM_USE_LINKER=lld, except during a 2-stage build where a dependency is added from the first stage to the second ensuring that lld is built before stage2 begins. To start with, we will assume that the Minisat library has proper CMake-based build and has been already built and installed in the system we are building on. They also need to be shipped along side with your library, and then the client code needs to link them too. txt module/ CMakeLists. WARNING: The "Other Dependencies" column of the tables is not complete! How to show dependencies. This notion of an interface in the CMake dependency graph is what makes the build system reasonable. Is it, or will it be possible to specify value of Ant Build -> Native Library Dependencies / Native Library Directories when generating NSight Tegra project from CMake? Because. The CMake based build system was rewritten for VTK 6, using a modular approach creating smaller libraries with less inter-library dependencies. If you do an 'ldd libSDL2. A Visual Studio developer might consider the project file (. Higher granularity may be achieved for per-configuration rules by creating and linking to IMPORTED library targets. The next part in the series will comprise of a CMake example using Qt and how a library can be exported using modern methodologies. Tips for Linking. a -Idmclnxlib -o run_foo I have already read the tutorial for. The others just add unnecessary bloat. cmake-script, in some directory that will be searched by find_package (I chose lib/foo), which then simply uses add_subdirectory, to add the library to the build tree. A prerequisite for successful linking of the demo-main target is availability of the local library build in the demo target. Install the library and the latest standalone driver separately; the driver bundled with the library is usually out-of-date. Using the previously mentioned trick, we will use a separate CMake file to setup and build our code generation tool. Linux/UNIX developers are often surprised to learn that creating a shared library on Windows known as a DLL (dynamic linked library) requires chang. I tried to use vcproj2cmake but it overly complicates to CMake file so I only took some of the stuff in it, I also added ideas from related questions and answers. The following should do the trick: add_library(LTexture SHARED libs/ltexture. GitHub Gist: instantly share code, notes, and snippets. With cmake, you'd use target_link_libraries. Prefer to pass full absolute paths to libraries where possible, since this ensures the correct library will always be linked. However, CMake has the dependency information baked into it for all known versions of Boost, so CMake must be newer than Boost for these to work. Adding Additional libraries. I love cmake, but unfortunately its documentation is more focused on completeness than on providing hands-on-examples. Obtaining the C++ Client. Re: [CMake] Is there a "package" equivalent for CMAKE_SKIP_INSTALL_ALL_DEPENDENCY Craig Scott [CMake] configuring FCGI2 -- check typedefs in include files? Kent Williams [CMake] graphviz missing dependencies when target spans multiple subfolders Rich von. CMake: Refactor external dependencies handling. It can be used to generate:. Cmake target_link_libraries not linking my library add_executable called with incorrect number of arguments CMake Error: Attempt to add link library "/usr/lib. Mostly used with add_custom_command and execute_process. Basically the '. This document is designed to allow you to get the Abseil development environment up and running using CMake. It tells CMake that in order to build the tests target, the catch library target has to be linked or added. cmake file with all the dependencies setting done. A short note on transitive dependencies: if the library you EXPORT depends on any targets, those targets will be recorded in the MyLibraryConfig. cmake Projects configured with the Vcpkg toolchain file will have the appropriate Vcpkg folders added to the cmake search paths. for example, source/link_foo. I was playing recently with Rust and one of the feature it supports is ability to link to C code. Step by step, we will learn the basics of CMake as a build system, along with the CLion settings and actions for CMake projects. I am using CMake to build my library, and I. Currently, if I want to use OpenCV as an emscripten dependency, I need to manually add the includes and libraries with some GLOB. If a library name matches another target dependencies are setup automatically so that the libraries will be built first and target will be updated whenever any of the libraries are. There is no binary library to link to, and no configured header file. The vm is new and I tried to install first. Now the app developer can easily use "find_package" and all transitive dependencies are resolved automatically. cpp ) add_library(globals SHARED libs/globals. a file, so I can just ship a big lib file to customers. STATIC / SHARED / MODULE specifiers should be used only in cases when other type of library is by design not possible for any reasons. We recommend that each person starting development with Abseil code at least run through this quick tutorial. The library is only shared between a handful of projects and is rather small, so I would really like to build it before it is linked. Flag to be used to link a library into a shared library or executable. This was a bit of a surprise, but just adding the target_link_libraries() command to the CMakeLists. This setting can be used to help CMake locate dependencies; it is. CMake will build the library as libtest. For example to add the RooStats library the user can specify it as an extra component (the name of the component is the name of the library without any library prefix or suffix). targetDependencies: A list of dependencies between projects and/or targets, that will be resolved before building. How to install My SQL Connector/C++ on Raspberry Pi With Cmake 1. Alternatively, there is a Python build script that builds COLMAP and its dependencies locally. CMAKE linking the system library We would like to build a shared library with CMAKE system. find_package(Qt4 COMPONENTS QTCORE QTGUI). 04) and Windows. txt files just to get the whole thing to compile. Cheers Matt. --system-libs: This switch forces the build system to link against Zlib, Bzip2, cURL, Expat and libarchive installed on the system. However, CMake has the dependency information baked into it for all known versions of Boost, so CMake must be newer than Boost for these to work. Jul 30, 2012 • While working on the test suite for C++11 Rocks, I needed to setup a cross-platform test suite based on Boost. Why does building libb first build liba? As I understand it liba should just be propagated as a link time dependency to whatever actually links it in (exec), but I realize I'm missing something. Our CMake configuration will then automatically link the corresponding Debug or Release GTSAM library to your project, depending on which configuration your project is compiled in. * CUDA driver series has a critical performance issue: do not use it. Cmake & openCL How to make a library. If your project doesn't, check out my tutorial on how to do it. Currently the library does compile without any external dependencies, however since you need to be able to import OSM data to make any use of the library you should at least have libxml2 or protobuf available. This book features a collection of recipes and building blocks with tips and techniques for working with CMake, CTest, CPack, and CDash. CMAKE_LINK_LIBRARY_FLAG¶ Flag to be used to link a library into an executable. Using dependencies. Join David Gassner for an in-depth discussion in this video Add Room library dependencies, part of Android Development Essential Training: Local Data Storage with Java. CPack is a packaging system for software distributions which is tightly integrated with CMake, but can function without it. INTERFACE Only used for targets that link against this library. Without cmake, in Visual Studio for example, follow these instructions. I would like to specify this dependency on the libraries, built by vcpkg. I went throught the docs, but was not able to find the dolution in a reasonable time so far. Use one of the CMake configuration editors (ccmake or cmake-gui), see Editing CMake Parameters. Library ‘targets’ in CMake keep track of associated include paths, dependent libraries, compile flags, and even extra source files, using ‘target properties’. This can get quite complex quite fast, CMake has many options. The following should do the trick: add_library(LTexture SHARED libs/ltexture. # x86 dynamic link library. I am developing my own header-only library that I want to use as a framework in other software. Use one of the CMake configuration editors (ccmake or cmake-gui), see Editing CMake Parameters. You can introduce the dependency in the /src level CMakeLists. 10 Chapter 4. The _init() routine, if present, is only called once. CMake Command-Line Tool Mode Cross-Platform commands for printing, zipping (tar or zip), moving, copying and deleting files or directories. All activated libraries are to be built after configuration. Adding Boost as a Dependency with CMake. For an executable with exports (see the ENABLE_EXPORTS target property) no default transitive link dependencies are used. Then, CMake generates build systems such as Makefiles or Visual Studio projects from these files. txt 1 Solution. I went throught the docs, but was not able to find the dolution in a reasonable time so far. PUBLIC Used for this target and all targets that link against it. There are many Cmake tutorials available on internet. CMake is a family of tools designed to build, test and package software. 5, imported targets were added. Well this is a “Getting Started with CMake” tutorial, but thank you for the feedback. To generate static libraries, use one of the triplets: x86-windows-static, or x64-windows-static. Also, my best advice is to keep CMake code clean - treat it as it would be production code. This setting can be used to help CMake locate dependencies; it is. As example we compile the following snippet with Visual Studio 2015. CMake is smart enough to link A with B and C, even if the dependency list of A only includes B. Then you'll have to setup the project to link with ozz libraries, which is build-system specific. 42]) target_link_libraries(my_target PUBLIC dependency_target) # for a proper library this also setups any required include directories or other compilation options The hard way. Building/installing flashlight creates libflashlight, which contains the entire flashlight library. The old-style library dependencies file does not take into account per-configuration names of libraries or the LINK_INTERFACE_LIBRARIES target property. Also I have observed differences in build order between ninja, make and vs2019. This is needed only on very few platforms. CMake is cross-platform, open-source software for managing the build process in a portable fashion. Click to share on Facebook (Opens in new window) Click to share on Twitter (Opens in new window) Click to share on LinkedIn (Opens in new window). $ sudo apt-get install mysql-server php5-mysql. Documentation mentions that they can be used to specify both the link dependencies and the link interface in one command. This target name can be passed to the TARGET_LINK_LIBRARIES command to tell CMake that an object A. a -Idmclnxlib -o run_foo I have already read the tutorial for. Test for code examples. Better understanding Linux secondary dependencies solving with examples 08 Jan 2015 by David Corvoysier. txt, after you've finished adding the libraries in your project. To link the prebuilt library to your own native library, add it to the target_link_libraries() command in your CMake build script: target_link_libraries( native-lib imported-lib app-glue ${log-lib} ) To package the prebuilt library into your APK, you need to manually configure Gradle with the sourceSets block to include the path to your. --version [file] Show program name/version banner and exit. It is also compatible with several compilers and third party libraries, and provides different interfaces to the functionality. The SYSTEM turns the include directory into a system include directory. Hello, I am trying to link the octomap library with openCV library, but I have problem when I tried to generate the file using cmake. This is needed only on very few platforms. The compromise favored by Linux packagers is to use the subproject as a fallback for the external dependency. The library does have some dependencies, however, which I'd like to be visible from the generated target. CMAKE_LINK_LIBRARY_FLAG¶ Flag to be used to link a library into an executable. find_package(dependency [VERSION 1. 2) add_library(foo foo. Linux; Windows; Dependencies; Use CMake; API Documentation. link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) Preprocessor Definitions. Can you confirm this statement is generally true both for > Unix and Windows? > Continuing with the example I used above, if the public headers of the middle library refer to anything from the inner library, then target_link_libraries() should specify PUBLIC, regardless of whether middle or inner are static or shared libraries. In Visual Studio 2010 there is an option, "Link Library Dependencies", which does exactly this. --no-system-jsoncpp: This switch removes the JSON-C++ library from the list of system libraries. CMake is smart enough to link A with B and C, even if the dependency list of A only includes B. cpp) find_package(MiniSat 2. vcxproj) and the solution file (. For example to add the RooStats library the user can specify it as an extra component (the name of the component is the name of the library without any library prefix or suffix). The way to show the dependencies varies from platform to platform. However, with CMake you can consider this to be an intermediate file too, as CMake will generate it and is recommended. This post demonstrates the steps to do so, using Cargo as a primary build tool for Rust part of the code, invoking CMake to do the native C code compilation, producing a static library that Rust picks up and calls. Among other things, cmake will generate makefiles for you. FreshPorts - new ports, applications. The intention of the talk was to present a ‘gathered opinion’ about what Modern CMake is and how it should be written. CMake, the cross-platform, open-source build system. cpp lib/dmclnx. This was a bit of a surprise, but just adding the target_link_libraries() command to the CMakeLists. All activated libraries are to be built after configuration. In case of an external target, obviously CMake can’t track the binary to its sources so won’t automatically rebuild your external project. /aws-iot-device-sdk-cpp/common/ConfigCommon. Use CMake builtin commands (link_directories() include_directories(), add_definitions(), target_link_libraries()) for those cases. txt file below I have a few questions. This is the point where CMake kicks in: As a developer of a library it is good practice to provide a CMake configuration script (see here how to write one) placed in the installation directory. For non-standard installations however, a complete set of override variables is available. Alternatively, the dependency can be internalized as a subproject - a Meson project within another - either contained or as a link. In your project's CMakeLists. with only. Bootstrapping a cmake project based on vcpkg in Visual Studio (this post) Bootstrapping a cmake project based on vcpkg in Linux and Visual Studio with idiomatic cmake. Link dependencies between modules are solved using the TARGET_LINK_LIBRARIES command. You can use the ldd command to display the shared library dependencies: Linking CXX static library libtestStudent. The cmake extras script will forward all include dirs and libraries as returned by the Gazebo CMake config and update the CMAKE_CXX_FLAGS variable. Let’s say you have a lib called libMyLib. Documentation mentions that they can be used to specify both the link dependencies and the link interface in one command. Linux/UNIX developers are often surprised to learn that creating a shared library on Windows known as a DLL (dynamic linked library) requires chang. In the VS2010 project settings, the paths never show references to the library paths that are part of cmake file script. Once you have a GCC toolchain, configure your build of LLVM to use the new toolchain for your host compiler and C++ standard library. CMake on windows cannot link to executable with exposed symbols I have a main executable that dynamically loads a shared library, both are compiled in the same CMake file. --system-libs: This switch forces the build system to link against Zlib, Bzip2, cURL, Expat and libarchive installed on the system. Meson can use the CMake find_package() function to detect dependencies with the builtin Find. CMake is a cross-platform build system generator where you describe different executables, binaries and their dependencies in CMakeLists. txt files in a sub-directory inherit properties set in the parent directory, reducing the amount of code duplication. CMake手册的客套话总算说完了,开始进入正题。第一部分是CMake命令。命令就相当于命令行下操作系统提供的各种命令,重要性不言而喻;可以说,这些命令是CMake构建系统的骨架。. We'll use CMake as build system in this case but keep in mind that Conan works with any build system and is not limited to using CMake. out carfully which version of. CMake is a family of tools designed to build, test and package software. This document is designed to allow you to get the Abseil development environment up and running using CMake. linking it to main. 4 ) PRIVATE Only used for this target. txt if add_executable (/library) is called from a function defined in an included file CMake MSVC_TOOLSET_VERSION is incorrect in Visual Studio 2019 VS API issue on CMake solutions in VS 16. I have the following CMakeLists. It comes both as a dynamic link library (. It can be used to generate:. I'm using a non-recommended way to include files. Also I have observed differences in build order between ninja, make and vs2019. 5) project(foo-sat LANGUAGES CXX) add_executable(foo main. This is the fourth and final part in a series of blog posts focusing on the client. I just started recently with this whole 64-bit computing and after some time trying to find a solution, I am quite lost. Dependencies between targets. --version [file] Show program name/version banner and exit. Remove the files created by make install since they will become stale. The library calls a function defined in the main executable, in Linux this is done successfully and the program works as expected, however in Windows the library fails to. Link dependencies between modules are solved using the TARGET_LINK_LIBRARIES command. for example, source/link_foo. The file CMakeLists. I love cmake, but unfortunately its documentation is more focused on completeness than on providing hands-on-examples. While CMake has become the de-facto standard buildsystem for C++, it's siblings CTest and CPack are less well known. Ensure ecl_build is listed as a dependency in your manifest. txt module1. Mostly used with add_custom_command and execute_process. The updated documentation for using CMake with Qt 5 is has been reviewed and generated and repeats the relevant information in this blog post. This is needed only on very few platforms. CMAKE_LIBRARY_PATH;-list of directories specifying a search path for the find_library() command. This tutorial shows various ways to use CMake's target_link_libraries() statement and explains the differences between them. Subscribe to this blog. So an external project linking my_library will not get any warnings from the header files of my library. How to Build an App with the ZED SDK Introduction. This notion of an interface in the CMake dependency graph is what makes the build system reasonable. CMake also maintains a list of all header files that objects depend on, so dependency checking can be assured. target_link_directories may be used here as well. Then, add add_subdirectory(tests) to your CMakeLists. Prepare transitive targets (modern CMake) and needed variables (global approach) to link with the dependencies. There is one global CMake variable, OGRE_DEPENDENCIES_DIR, which you can set if all the dependencies are in a shared folder with the following structure: OGRE_DEPENDENCIES_DIR include - Include files for all the dependencies; lib -. Is there an intended behavior in. Mingw64: add a statically linked library adds libstdc++ dependency. cmake The enclosed python script will download and install cmake. This book features a collection of recipes and building blocks with tips and techniques for working with CMake, CTest, CPack, and CDash. target_link_libraries(target library…) Specify that target needs to be linked against one or more libraries. Well this is a “Getting Started with CMake” tutorial, but thank you for the feedback. Btw, linking against log4cpp and adding it to the library search path doesn’t make much sense, since the library is referenced by an absolute path. CMake maintains throughout the whole project a named object for each target created by a command such as ADD_EXECUTABLE() or ADD_LIBRARY(). I went throught the docs, but was not able to find the dolution in a reasonable time so far. txt also are in the generated Makefiles. Using external (CMake) libraries as third party libraries? 08-09-2017, 09:16 PM I've been on a mission to get the libraries I have in CMake working in my UE4 project, where the UE4 project will be able to link in targets, by name, including all transitive dependencies (if we specify LibA and it requires LibB and LibC, we need to link all three. CMake: Refactor external dependencies handling. That is, you describe the different executables and binaries and their dependencies CMakeLists. Very few applications are fully self-contained, but rather they use external libraries and frameworks to do their work. cpp ) add_library(constants SHARED libs/constants. Manage code complexity and library dependencies with reusable CMake building blocks Book Description. cmake file by name. link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) Preprocessor Definitions. To build using Visual Studio or some other IDE supported by CMake, most of the information below still applies) Always compile in a separate directory to the code. In this blog post I will describe the necessary steps to use SDL2 with CMake on both Linux (Ubuntu 17. If you do an 'ldd libSDL2. Install the dependencies by copying and pasting the following lines to the command line: sudo apt-get update sudo apt-get install build-essential flex bison cmake zlib1g-dev libboost-system-dev libboost-thread-dev libopenmpi-dev openmpi-bin gnuplot libreadline-dev libncurses-dev libxt-dev. o files upon. a) #the "demo" name here will be the same as your module's name. By default linking to a shared library target transitively links to targets with which the library itself was linked. I'd use the include_directories, add_definitions and add_compile_options command in the top-level or in mid-level CMakeLists. A short note on transitive dependencies: if the library you EXPORT depends on any targets, those targets will be recorded in the MyLibraryConfig.