Multiples Cmake in a project

2

I'm developing an application in C ++, where I need to use a library I've developed before with CMake. But I do not want to call the binary directly because each platform will have to have a binary separately, and it's annoying to have to compile each one to later compile the project, my question is this, you can call CMake from my other project to compile the dependency to then compile this new project already linking dependency? If so, how will I do this miracle? Project that I want to use link . CMake the new project that will use this above:

cmake_minimum_required(VERSION 3.4)
project(DataBase)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp DataBase.cpp DataBase.h String.h libString.a)
add_executable(DataBase ${SOURCE_FILES})
    
asked by anonymous 24.04.2016 / 07:29

1 answer

0

Pedro Soares,

You need to use add_subdirectory(xpto) in your main CMakeLists.txt.

Follow the blog post on how to modularize libraries in C ++.

link

You can see the example in the git repository of the post above:

link

Abs, Fernando Gomes

    
03.04.2018 / 18:50