Skip to content

Instantly share code, notes, and snippets.

@pileon
Created March 21, 2018 12:10
Show Gist options
  • Save pileon/35eb30777a85938d05f0a4952d8add26 to your computer and use it in GitHub Desktop.
Save pileon/35eb30777a85938d05f0a4952d8add26 to your computer and use it in GitHub Desktop.
Defining macros in CMake for use in source
cmake_minimum_required(VERSION 3.10)
project(Macro)
set(CMAKE_CXX_STANDARD 11)
add_executable(Macro main.cpp)
target_compile_definitions(Macro PUBLIC PATHTOPYTHONSCRIPT=\"${CMAKE_SOURCE_DIR}/bin/postprocessing/extractlinedata.py\")
#include <iostream>
#include <limits>
int main()
{
std::string command = "pvpython " PATHTOPYTHONSCRIPT " -f test_liddrivencavity_re1000-00009.vtu -p1 0.5 0 0 -p2 0.5 1 0";
std::cout << "The command is '" << command << "'\n";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment