Merge pull request #93 from madebr/cmake_tools_mainproject

cmake: build tools and install librw by default, only when main project
This commit is contained in:
aap 2021-08-19 16:18:25 +02:00 committed by GitHub
commit 6b9c546ec1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
set(librw_MAINPROJECT ON)
if(DEFINED PROJECT_NAME)
set(librw_MAINPROJECT OFF)
endif()
cmake_minimum_required(VERSION 3.8) cmake_minimum_required(VERSION 3.8)
project(librw project(librw
VERSION 0.0.1 VERSION 0.0.1
@ -54,8 +59,8 @@ endif()
include(CMakeDependentOption) include(CMakeDependentOption)
option(LIBRW_TOOLS "Build librw tools" ON) option(LIBRW_TOOLS "Build librw tools" ${librw_MAINPROJECT})
option(LIBRW_INSTALL "Install librw files" OFF) option(LIBRW_INSTALL "Install librw files" ${librw_MAINPROJECT})
cmake_dependent_option(LIBRW_EXAMPLES "Build librw examples" ON "LIBRW_TOOLS;NOT LIBRW_PLATFORM_NULL" OFF) cmake_dependent_option(LIBRW_EXAMPLES "Build librw examples" ON "LIBRW_TOOLS;NOT LIBRW_PLATFORM_NULL" OFF)
if(LIBRW_INSTALL) if(LIBRW_INSTALL)