Hooray! Thanks!
Could a future version of cmake provide a nicer way to do this, without these
error messages?
0 Fri 12:29:25 yost DaveBook ~/p/c++/cmake/custom-command-target/build
391 Z% make foo.cc
Scanning dependencies of target foo.cc
make[3]: Circular CMakeFiles/foo.cc <- foo.cc dependency
If you run "make help" it will list targets it understands. And as you
pointed out there is no target for foo.cc. You can "make foo" but if you
really want a target for foo.cc you can add one yourself:
cmake_minimum_required(VERSION 3.0.0)
project(custom-command-target)
add_custom_command (
I’m not doing it wrong. Remember, this is a simplified example.
We want to be able to make foo.cc so we can look at it and compare it. Yes, we
could make foo and then look at foo.cc, but until foo.cc is right, we will
suffer a lot of compiler error clutter. When foo.cc looks right, then we will
You’re doing it all wrong. You do not name source files as make targets, but
the target name (or project name, I have no idea, because it rarely makes sense
to name them differently). Try simply “foo” or “custom-command-target”. You
would never say “make foo.cpp”, not even in an ordinary GNU Mak
In this example, how do I get
make foo.cc
to work?
0 Thu 16:56:19 yost DaveBook ~/p/c++/cmake/custom-command-target
369 Z% bundle CMakeLists.txt genFoo
#!/usr/bin/env unbundle
# See http://yost.com/computers/bundle/
CMakeLists.txt
cmake_minimum_required(VERSION 3.3.0)
project(custom-c