diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-02-23 12:23:44 +0100 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-06-06 18:27:02 +0200 |
commit | f73b36c2f342ff9bef5ebc9ca49fa14f54b81d85 (patch) | |
tree | 0fa1932f32e3c9fdb9483fff166e65c0af3aa2b4 | |
parent | d9481f23599d8eab5ef4bceb9cde23a14ef4f066 (diff) | |
download | meson-f73b36c2f342ff9bef5ebc9ca49fa14f54b81d85.zip meson-f73b36c2f342ff9bef5ebc9ca49fa14f54b81d85.tar.gz meson-f73b36c2f342ff9bef5ebc9ca49fa14f54b81d85.tar.bz2 |
cmake: Added test for configure_file
4 files changed, 16 insertions, 0 deletions
diff --git a/test cases/cmake/2 advanced/main.cpp b/test cases/cmake/2 advanced/main.cpp index 315c0f7..6cc4c0c 100644 --- a/test cases/cmake/2 advanced/main.cpp +++ b/test cases/cmake/2 advanced/main.cpp @@ -1,5 +1,10 @@ #include <iostream> #include <cmMod.hpp> +#include "config.h" + +#if CONFIG_OPT != 42 +#error "Invalid value of CONFIG_OPT" +#endif using namespace std; diff --git a/test cases/cmake/2 advanced/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/2 advanced/subprojects/cmMod/CMakeLists.txt index b4cf698..3f33e4d 100644 --- a/test cases/cmake/2 advanced/subprojects/cmMod/CMakeLists.txt +++ b/test cases/cmake/2 advanced/subprojects/cmMod/CMakeLists.txt @@ -7,6 +7,9 @@ find_package(ZLIB REQUIRED) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib) +set(CONFIG_OPT 42) +configure_file("config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY) + add_library(cmModLib SHARED lib/cmMod.cpp) add_executable(testEXE main.cpp) diff --git a/test cases/cmake/2 advanced/subprojects/cmMod/config.h.in b/test cases/cmake/2 advanced/subprojects/cmMod/config.h.in new file mode 100644 index 0000000..f538ac9 --- /dev/null +++ b/test cases/cmake/2 advanced/subprojects/cmMod/config.h.in @@ -0,0 +1,3 @@ +#pragma once + +#define CONFIG_OPT @CONFIG_OPT@ diff --git a/test cases/cmake/2 advanced/subprojects/cmMod/lib/cmMod.cpp b/test cases/cmake/2 advanced/subprojects/cmMod/lib/cmMod.cpp index cb20844..027296e 100644 --- a/test cases/cmake/2 advanced/subprojects/cmMod/lib/cmMod.cpp +++ b/test cases/cmake/2 advanced/subprojects/cmMod/lib/cmMod.cpp @@ -1,5 +1,10 @@ #include "cmMod.hpp" #include <zlib.h> +#include "config.h" + +#if CONFIG_OPT != 42 +#error "Invalid value of CONFIG_OPT" +#endif using namespace std; |