diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-06-16 13:16:55 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-06-16 13:16:55 +0200 |
commit | 6025e509b1bde02299696f7fd81f4d11983d9e2d (patch) | |
tree | c7013c466f0e5482ae100afe766a9699e968b6d5 /cmake | |
parent | 233fe0ea64a53cc6426a88e1543a354698ba8304 (diff) |
cmake: don't pass OPENTRACK_ORG on cmdline
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/opentrack-boilerplate.cmake | 7 | ||||
-rw-r--r-- | cmake/opentrack-org.cmake | 21 |
2 files changed, 22 insertions, 6 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake index b7a5e295..0214b5ef 100644 --- a/cmake/opentrack-boilerplate.cmake +++ b/cmake/opentrack-boilerplate.cmake @@ -194,12 +194,7 @@ function(otr_module n_) string(REPLACE "-" "_" build-n ${n_}) string(TOUPPER "${build-n}" build-n) target_compile_definitions(${n} PRIVATE "BUILD_${build-n}") - - get_property(ident GLOBAL PROPERTY opentrack-ident) - if (".${ident}" STREQUAL ".") - message(FATAL_ERROR "must set global property `opentrack-ident' in `opentrack-variant.cmake'") - endif() - target_compile_definitions(${n} PRIVATE OPENTRACK_ORG=\"${ident}\") + include(opentrack-org) if(arg_STATIC) set(arg_NO-INSTALL TRUE) diff --git a/cmake/opentrack-org.cmake b/cmake/opentrack-org.cmake new file mode 100644 index 00000000..107c829b --- /dev/null +++ b/cmake/opentrack-org.cmake @@ -0,0 +1,21 @@ +include_guard(GLOBAL) +function(otr_write_org) + get_property(ident GLOBAL PROPERTY opentrack-ident) + if (ident STREQUAL "") + message(FATAL_ERROR "must set global property `opentrack-ident' in `opentrack-variant.cmake'") + endif() + otr_escape_string(ident "${ident}") + set(new-str "#pragma once +#define OPENTRACK_ORG \"${ident}\" +") + + set(filename "${CMAKE_BINARY_DIR}/opentrack-org.hxx") + set(old-str "") + if(EXISTS "${filename}") + file(READ "${filename}" old-str) + endif() + if(NOT old-str STREQUAL new-str) + file(WRITE "${filename}" "${new-str}") + endif() +endfunction() +otr_write_org() |