These are chat archives for inbilla/CMake

24th
Feb 2018
Iain Reid
@iainreid820
Feb 24 2018 15:27
Hello, I’m sorry if this is a simple question to be asking, but I’m trying to use libgit2 in a C++ project, and include it via CMake, on including the library I get a “file not found” error:
/path/to/repo/vendor/libgit2/src/common.h:14:10: fatal error:
      'git2/common.h' file not found
#include "git2/common.h"
         ^~~~~~~~~~~~~~~
1 error generated.
How should I include such libraries? My CMakeLists file looks like this at the moment:
project (base16-builder)
cmake_minimum_required (VERSION 3.0.2)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++ -std=c++1y -DBUILD_CLAR=OFF -DTHREADSAFE=ON -DSTDCALL=OFF")

set(BASE16_BUILDER_VERSION 0.0.1)

add_subdirectory(vendor/libgit2)
add_subdirectory(vendor/mstch)

include_directories(
  ${libgit2_SOURCE_DIR}
  ${libgit2_BINARY_DIR}
  ${mstch_INCLUDE_DIR})

add_executable(base16-builder src/base16_builder.cpp)
target_link_libraries(base16-builder git2 mstch)
Note that mstch works perfectly
twln
@twln
Feb 24 2018 22:38
@comicfans does it only work with msvc or is there support already for unix systems? I'm trying to build on ubuntu, but getting errors saying clang is broken even though it works with vanilla cmake 3.10