Or, you might want to remove the ALL from your custom target, so that you have to explicitly run make docs to generate the documentation. In practice, you might also want to make the custom command depend on all your source code, so it gets regenerated every time you change the code. But as a special case, you can use add_custom_target(ALL) to create a new target attached to the “all” target: add_custom_target( How about using add_dependencies()? No, you can’t use that with any of the built in targets. So we need to add a dependency between docs/doxygen.stamp and the “all” target. Nothing depends on the documentation, so it isn’t built. But actually, here’s what to expect: nothing! If you build this, you get no output. We have to create a ‘stamp’ file because Doxygen generates lots of different files, and we can’t really tell CMake what to expect. "Generating API documentation with Doxygen" You may live to regret ever letting it in. This is where add_custom_command() enters your life. If your project is a good one then maybe you use a documentation tool like GTK-Doc or Doxygen to generate documentation from the code. There are also “install” and “test” targets built in ( but no “clean” target). What is “all”, in the dependency graph to the left? It’s a built in target, and it’s the default target. When you run CMake, both of them get built. You have a library, and a program that depends on it. This is CMake at its simplest (and best). Here is a hopefully complete list of things you might want to do in CMake that involve custom commands and custom targets depending on each other, and some explainations as to why things don’t work the way that you might expect. What makes it so hard is that there’s not one limitation, but several. But files aren’t targets and have all sorts of exciting limitations to make you forget everything you ever new about dependency management. If you want to generate some kind of file at build time, in some manner other than compiling C or C++ code, then you need to use a custom command to generate the file. If you’ve tried do anything non-trivial in CMake using the add_custom_command() command, you may have got stuck in this horrible swamp of confusion. Unfortunately, not everything is a target though! In this case xcode-select -reset works as pointed by akozin.As I said in my last post about CMake, targets are everything in CMake. You may get an error message: "Can't install the software because it is not currently available from the Software Update server". I found the solution in this question, Command Line Tools not working. Sudo xcode-select -switch /Library/Developer/CommandLineTools sudo xcode-select -switch /Applications/Xcode.app As a follow on step, you may need to reset the path to Xcode if you have several versions or want the command line tools to run without Xcode. The problem is that one needs to explicitly agree to the license agreement. If the above alone doesn't do it, then also run: sudo xcode-select -reset You do not need Xcode, you can install only the Command Line Tools here, it is about 130 MB (600 MB as of Xcode v14.1). (The popped Window may be behind other windows.) This will pop a dialogue box, Select "Install", and it will download and install the Command Line Tools package and fix the problem. Open Terminal, and run the following: xcode-select -install
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |