cmake: build tools and install librw by default, only when main project

This commit is contained in:
Anonymous Maarten 2021-08-19 16:09:30 +02:00
parent 57559969f7
commit 7740b073b0

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)