John LaGrone wrote
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
project(ex1)
find_package(foo REQUIRED)
add_executable(ex1.x ex1.c)
target_link_libraries(ex1.x foo)
Just check that library exists already:
if(NOT TARGET foo)
find_package(foo REQUIRED)
endif()
--
View this message
Hi John.
I have no first-hand experience with it, but I believe the ExternalProject
module could be just what you're looking for (
http://www.cmake.org/cmake/help/v3.2/module/ExternalProject.html ). It
allows you to configure and build several projects at build time under a
CMake superbuild
On 07/08/2015 06:52 PM, cmake-requ...@cmake.org wrote:
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
project(ex1)
find_package(foo REQUIRED)
add_executable(ex1.x ex1.c)
target_link_libraries(ex1.x foo)
I don't understand. Does building the examples and lib (ie, 'everything')
together
John LaGrone wrote:
However, if I try to build the
examples and the library at the same time, the configuration fails
because it cannot find the library foo for examples because it has not
been compiled.
I know I can build everything at once and it will work, ...
I don't understand. Does
I am trying to build a library along with examples on how to use the
library. For simplicity, let's say the structure is
CMakeLists.txt
src/
CMakeLists.txt
foo.c
foo.h
examples/
CMakeLists.txt
ex1/
CMakeLists.txt
ex1.c
ex2/
CMakeLists.txt