Improve subproj handling and deprecated target options:

Exclude several libraries from build when we are included in a
super-project (this is the case when someone only wants to use
xrpl_core). Force several target (deprecated) params to be cache
variables since they are now exposed as options.
This commit is contained in:
Mike Ellery
2018-08-01 16:46:35 -07:00
committed by seelabs
parent 7a547b8cf2
commit dbc8f147c9
2 changed files with 25 additions and 8 deletions

View File

@@ -50,11 +50,11 @@ macro(parse_target)
endif()
if (${cur_component} STREQUAL unity)
set(unity true)
set(unity ON CACHE BOOL "" FORCE)
endif()
if (${cur_component} STREQUAL nounity)
set(unity false)
set(unity OFF CACHE BOOL "" FORCE)
endif()
if (${cur_component} STREQUAL debug)
@@ -66,12 +66,12 @@ macro(parse_target)
endif()
if (${cur_component} STREQUAL coverage)
set(coverage true)
set(coverage ON CACHE BOOL "" FORCE)
set(debug true)
endif()
if (${cur_component} STREQUAL profile)
set(profile true)
set(profile ON CACHE BOOL "" FORCE)
endif()
endwhile()
endif()
@@ -108,3 +108,10 @@ macro(group_sources curdir)
group_sources_in(${PROJECT_SOURCE_DIR} ${curdir})
endmacro()
macro (exclude_if_included target_)
if (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
set_target_properties (${target_} PROPERTIES EXCLUDE_FROM_ALL ON)
set_target_properties (${target_} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD ON)
endif ()
endmacro ()