Created
June 16, 2016 14:52
-
-
Save AlecTaylor/e416efbea8793da599513bf28e7d92d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.5) | |
project(foo_proj) | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") | |
set(SOURCE_FILES main.cpp) | |
add_custom_command( | |
OUTPUT bar.h | |
COMMAND echo \#define bar 10 > bar.h | |
DEPENDS main.cpp | |
) | |
add_executable(foo_proj ${SOURCE_FILES} bar.h) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "bar.h" | |
// Also tried `#include <bar.h>` | |
int main() { | |
std::cout << bar << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment