1# - Returns whether the current project is on its own or within another project's build 2# 3# get_subproject_status(<resultvar>) - resultvar will be YES if we are 4# included in another project, or NO if we are being built separately 5# 6# Requires CMake 2.6 or newer (uses the 'function' command) 7# 8# Original Author: 9# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net> 10# http://academic.cleardefinition.com 11# Iowa State University HCI Graduate Program/VRAC 12# 13# Copyright Iowa State University 2009-2010. 14# Distributed under the Boost Software License, Version 1.0. 15# (See accompanying file LICENSE_1_0.txt or copy at 16# http://www.boost.org/LICENSE_1_0.txt) 17 18if(__get_subproject_status) 19 return() 20endif() 21set(__get_subproject_status YES) 22 23function(get_subproject_status _var) 24 if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") 25 # Base source dir is our source dir - we are top-level 26 set(${_var} NO PARENT_SCOPE) 27 else() 28 # Base source dir is not our source dir - we are a subproject 29 set(${_var} YES PARENT_SCOPE) 30 endif() 31endfunction() 32