I'm trying to create a cmake equivalent to the following make:
demo: main.cpp
gcc -o demo main.cpp
./demo
demo is executed whenever demo is created.
This what I came to, but demo is not executed as I want:
add_executable(demo main.cpp)
add_custom_target(run_demo demo)
This is actually equivalent to:
all: demo
demo: main.cpp
gcc -o demo main.cpp
run_demo:demo
What do I miss?