cmake: Added test for configure_file

pull/4969/head
Daniel Mensinger 6 years ago
parent d9481f2359
commit f73b36c2f3
No known key found for this signature in database
GPG Key ID: 54DD94C131E277D4
  1. 5
      test cases/cmake/2 advanced/main.cpp
  2. 3
      test cases/cmake/2 advanced/subprojects/cmMod/CMakeLists.txt
  3. 3
      test cases/cmake/2 advanced/subprojects/cmMod/config.h.in
  4. 5
      test cases/cmake/2 advanced/subprojects/cmMod/lib/cmMod.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;

@ -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)

@ -0,0 +1,3 @@
#pragma once
#define CONFIG_OPT @CONFIG_OPT@

@ -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;

Loading…
Cancel
Save