diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-02-09 21:23:16 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-02-09 21:23:16 +0100 |
commit | 23857dc1e8a0aee2a1ce3b53d06bb724e47b90a7 (patch) | |
tree | 9cecd8e43a37f66663b1e66d56a4449107580773 /cmake | |
parent | ec771046fe323e8cd6e337cc5b799c39779e9c79 (diff) |
cmake: wrap around for function var scope
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/opentrack-boilerplate.cmake | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index 0e9516a8..10ef96a3 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -28,14 +28,18 @@ set(new-hier-path "#pragma once include_directories("${CMAKE_BINARY_DIR}") -set(hier-path-filename "${CMAKE_BINARY_DIR}/opentrack-library-path.hxx") -set(orig-hier-path "") -if(EXISTS "${hier-path-filename}") - file(READ ${hier-path-filename} orig-hier-path) -endif() -if(NOT (orig-hier-path STREQUAL new-hier-path)) - file(WRITE "${hier-path-filename}" "${new-hier-path}") -endif() +function(otr_write_library_paths) + set(hier-path-filename "${CMAKE_BINARY_DIR}/opentrack-library-path.hxx") + set(orig-hier-path "") + if(EXISTS "${hier-path-filename}") + file(READ ${hier-path-filename} orig-hier-path) + endif() + if(NOT (orig-hier-path STREQUAL new-hier-path)) + file(WRITE "${hier-path-filename}" "${new-hier-path}") + endif() +endfunction() + +otr_write_library_paths() function(otr_glob_sources var) set(basedir "${CMAKE_CURRENT_SOURCE_DIR}") |