commit 2d50c880397639d8d939812dc1d4f14804f14c22
parent cb7f353ffc7e5ec26726ab582939f79f54982152
Author: Jean Pierre Cimalando <jp-dev@inbox.ru>
Date: Fri, 21 May 2021 21:01:20 +0200
cmake: build libs+examples when configured from the DPF dir
Diffstat:
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -2,7 +2,15 @@ cmake_minimum_required(VERSION 3.7)
project(DPF)
-option(DPF_EXAMPLES "Build the examples" OFF)
+# check if we are building from this project, or are imported by another
+if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
+ set(DPF_BUILD_FROM_HERE TRUE)
+else()
+ set(DPF_BUILD_FROM_HERE FALSE)
+endif()
+
+option(DPF_LIBRARIES "Build the libraries" "${DPF_BUILD_FROM_HERE}")
+option(DPF_EXAMPLES "Build the examples" "${DPF_BUILD_FROM_HERE}")
set(DPF_ROOT_DIR "${PROJECT_SOURCE_DIR}" CACHE INTERNAL
"Root directory of the DISTRHO Plugin Framework.")
@@ -10,6 +18,11 @@ set(DPF_ROOT_DIR "${PROJECT_SOURCE_DIR}" CACHE INTERNAL
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(DPF-plugin)
+if(DPF_LIBRARIES)
+ dpf__add_dgl_cairo()
+ dpf__add_dgl_opengl()
+endif()
+
if(DPF_EXAMPLES)
add_subdirectory("examples/CairoUI")
#add_subdirectory("examples/ExternalUI")
diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake
@@ -280,7 +280,7 @@ function(dpf__add_dgl_cairo)
find_package(PkgConfig)
pkg_check_modules(CAIRO "cairo" REQUIRED)
- dpf__add_static_library(dgl-cairo EXCLUDE_FROM_ALL
+ dpf__add_static_library(dgl-cairo STATIC
"${DPF_ROOT_DIR}/dgl/src/Application.cpp"
"${DPF_ROOT_DIR}/dgl/src/Color.cpp"
"${DPF_ROOT_DIR}/dgl/src/Geometry.cpp"
@@ -326,7 +326,7 @@ function(dpf__add_dgl_opengl)
find_package(OpenGL REQUIRED)
- dpf__add_static_library(dgl-opengl EXCLUDE_FROM_ALL
+ dpf__add_static_library(dgl-opengl STATIC
"${DPF_ROOT_DIR}/dgl/src/Application.cpp"
"${DPF_ROOT_DIR}/dgl/src/Color.cpp"
"${DPF_ROOT_DIR}/dgl/src/Geometry.cpp"