


This way, you can open folders with a CMakeLists.txt file directly via File > Open > Folder. I'm not exactly sure what I'm doing wrong, this my first time using CMake so I mostly wrote my CMakeLists file using bits and examples from the internet. The CMake support is directly integrated since Visual Studio 2017. If it is relevant, the bananas.cpp include header statement looks like this: #include ".\.\include\bananas\bananas.h" It compiles with CMake and generates its files, however when I run make to actually compile the library, I get an error in the bananas.cpp file (first file it chooses to compile) that it cannot find the bananas.h header file. Target_include_directories( # Add the Headers to the Lib This variable affects the order of include directories generated in compiler command lines. $/include/*.hppįile(GLOB_RECURSE SOURCES # Fetch all of the Lib's SrcsĪdd_library( # Create the Library from Srcs CMake Documentation cmake-variables (7) CMAKEINCLUDEDIRECTORIESPROJECTBEFORE CMAKEINCLUDEDIRECTORIESPROJECTBEFORE Whether to force prepending of project include directories. I've created the following CMakeLists.txt file (located in Root): cmake_minimum_required(VERSION 2.8) # Version 2.8 requiredįile(GLOB_RECURSE HEADERS # Fetch all of the Lib's Headers I've been using Visual Studio to compile it and it works fine but now I want to diversify it by allowing the library to be compiled using CMake. I have a library project whose hierarchy looks something like this: Root:
