Skip to content

Commit

Permalink
cmake: test target_compile_definitions (PRIVATE, PUBLIC)
Browse files Browse the repository at this point in the history
Test case for mesonbuild#7299
  • Loading branch information
mensinda committed Jun 12, 2020
1 parent 49a9742 commit 8a549d7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test cases/cmake/1 basic/subprojects/cmMod/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
4 changes: 4 additions & 0 deletions test cases/cmake/1 basic/subprojects/cmMod/cmMod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
4 changes: 4 additions & 0 deletions test cases/cmake/1 basic/subprojects/cmMod/cmMod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#include "cmmodlib++_export.h"
#include <string>

#if MESON_MAGIC_FLAG != 42 && MESON_MAGIC_FLAG != 21
#error "Invalid MESON_MAGIC_FLAG"
#endif

class CMMODLIB___EXPORT cmModClass {
private:
std::string str;
Expand Down

0 comments on commit 8a549d7

Please sign in to comment.