| 1 |
# @HEADER |
| 2 |
# ***************************************************************************** |
| 3 |
# TriBITS: Tribal Build, Integrate, and Test System |
| 4 |
# |
| 5 |
# Copyright 2013-2016 NTESS and the TriBITS contributors. |
| 6 |
# SPDX-License-Identifier: BSD-3-Clause |
| 7 |
# ***************************************************************************** |
| 8 |
# @HEADER |
| 9 |
|
| 10 |
# Get the directory containing the file currently being processed. |
| 11 |
# |
| 12 |
# This is equivalent to getting the value of CMAKE_CURRENT_LIST_DIR in |
| 13 |
# cmake versions greater than 2.8.4, but we provide this wrapper macro |
| 14 |
# for compatibility. If called outside of a function or macro, this |
| 15 |
# will return the directory of the calling file. If called within a |
| 16 |
# function or macro, this will return the directory containing the |
| 17 |
# caller. |
| 18 |
function(get_current_list_dir output_variable) |
| 19 |
if(NOT DEFINED CMAKE_CURRENT_LIST_DIR) |
| 20 |
get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) |
| 21 |
endif() |
| 22 |
set(${output_variable} "${CMAKE_CURRENT_LIST_DIR}" PARENT_SCOPE) |
| 23 |
endfunction() |