From 8a549d7b2a79824030b3c046a28a9920ce1ce15d Mon Sep 17 00:00:00 2001 From: Daniel Mensinger Date: Fri, 12 Jun 2020 22:03:50 +0200 Subject: [PATCH] cmake: test target_compile_definitions (PRIVATE, PUBLIC) Test case for #7299 --- test cases/cmake/1 basic/subprojects/cmMod/CMakeLists.txt | 2 ++ test cases/cmake/1 basic/subprojects/cmMod/cmMod.cpp | 4 ++++ test cases/cmake/1 basic/subprojects/cmMod/cmMod.hpp | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/test cases/cmake/1 basic/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/1 basic/subprojects/cmMod/CMakeLists.txt index 9798209b0ae5..9c95636b9ceb 100644 --- a/test cases/cmake/1 basic/subprojects/cmMod/CMakeLists.txt +++ b/test cases/cmake/1 basic/subprojects/cmMod/CMakeLists.txt @@ -8,5 +8,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_definitions("-DDO_NOTHING_JUST_A_FLAG=1") add_library(cmModLib++ SHARED cmMod.cpp) +target_compile_definitions(cmModLib++ PRIVATE MESON_MAGIC_FLAG=21) +target_compile_definitions(cmModLib++ INTERFACE MESON_MAGIC_FLAG=42) include(GenerateExportHeader) generate_export_header(cmModLib++) diff --git a/test cases/cmake/1 basic/subprojects/cmMod/cmMod.cpp b/test cases/cmake/1 basic/subprojects/cmMod/cmMod.cpp index d3141d5123a4..f4cbea0ce0dd 100644 --- a/test cases/cmake/1 basic/subprojects/cmMod/cmMod.cpp +++ b/test cases/cmake/1 basic/subprojects/cmMod/cmMod.cpp @@ -2,6 +2,10 @@ using namespace std; +#if MESON_MAGIC_FLAG != 21 +#error "Invalid MESON_MAGIC_FLAG (private)" +#endif + cmModClass::cmModClass(string foo) { str = foo + " World"; } diff --git a/test cases/cmake/1 basic/subprojects/cmMod/cmMod.hpp b/test cases/cmake/1 basic/subprojects/cmMod/cmMod.hpp index 0e6dc0484f9b..4445e1f53c67 100644 --- a/test cases/cmake/1 basic/subprojects/cmMod/cmMod.hpp +++ b/test cases/cmake/1 basic/subprojects/cmMod/cmMod.hpp @@ -3,6 +3,10 @@ #include "cmmodlib++_export.h" #include +#if MESON_MAGIC_FLAG != 42 && MESON_MAGIC_FLAG != 21 +#error "Invalid MESON_MAGIC_FLAG" +#endif + class CMMODLIB___EXPORT cmModClass { private: std::string str;