aboutsummaryrefslogtreecommitdiffstats
path: root/build/conf
diff options
context:
space:
mode:
authorsvidyuk <svidyuk@yandex-team.ru>2022-04-13 09:27:11 +0300
committersvidyuk <svidyuk@yandex-team.ru>2022-04-13 09:27:11 +0300
commitc4847818d8a382f7a09aa3b3d998fcd2148e8779 (patch)
tree43c96ff4f9b0c0af6621a20e6490ab70f22c83d5 /build/conf
parent212c9e2367f2392b02e60c5f2f873871032617ee (diff)
downloadydb-c4847818d8a382f7a09aa3b3d998fcd2148e8779.tar.gz
Resolution for cmake target names conflicts
DEVTOOLS-9035 ref:2d37e3e9223ccf599361560aa5b1cfae6f0aa6c0
Diffstat (limited to 'build/conf')
-rw-r--r--build/conf/opensource.conf34
1 files changed, 34 insertions, 0 deletions
diff --git a/build/conf/opensource.conf b/build/conf/opensource.conf
index 9d84163f10..83c23d1421 100644
--- a/build/conf/opensource.conf
+++ b/build/conf/opensource.conf
@@ -18,3 +18,37 @@ when ($OPENSOURCE) {
HAVE_MKL=no
USE_MKL=no
}
+
+# Extra macros to control how cmake export works
+
+CMAKE_PACKAGE=
+CMAKE_PACKAGE_COMPONENT=
+CMAKE_PACKAGE_TARGET=
+CONAN_REFERENCE=
+CONAN_PKG_OPTS=
+### @usage: OPENSOURCE_EXPORT_REPLACEMENT(CMAKE PkgName CMAKE_TARGET PkgName::PkgTarget CONAN ConanRef CMAKE_COMPONENT OptCmakePkgComponent)
+###
+### Use specified conan/system pacakcge when exporting cmake build scripts for arcadia C++ project
+### for opensource publication.
+macro OPENSOURCE_EXPORT_REPLACEMENT(CMAKE[], CMAKE_TARGET[], CMAKE_COMPONENET[], CONAN[], CONAN_OPTIONS[]) {
+ SET(CMAKE_PACKAGE $CMAKE)
+ SET(CMAKE_PACKAGE_COMPONENT $CMAKE_COMPONENET)
+ SET(CMAKE_LINK_TARGET $CMAKE_TARGET)
+ SET(CONAN_REFERENCE $CONAN)
+ SET(CONAN_PKG_OPTS $CONAN_OPTIONS)
+}
+
+CMAKE_TARGET_NAME=$REALPRJNAME
+CMAKE_TARGET_ARTEFACT_RENAME_RULES=
+### @usage CMAKE_EXPORTED_TARGET_NAME(Name)
+###
+### Forces to use the name given as cmake target name without changing the name of output artefact.
+### This macro should be used to resolve target name conflicts in exported cmake project when
+### changing module name is not applicable. For example both CUDA and non-CUDA py modules for
+### catboost should have same name lib_catboost.so and both of them are defined as PY_ANY_MODULE(_catboost).
+### adding CMAKE_EXPORTED_TARGET_NAME(_catboost_non_cuda) to the non CUDA module ya.make file
+### changes exported cmake target name but preserve generated artefact file name.
+macro CMAKE_EXPORTED_TARGET_NAME(Name) {
+ SET(CMAKE_TARGET_NAME $Name)
+ SET(CMAKE_TARGET_ARTEFACT_RENAME_RULES && set_target_property OUTPUT_NAME $REALPRJNAME)
+}