-
Notifications
You must be signed in to change notification settings - Fork 78
cmake AddHtmlTarget: use config_file() for copying files #354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: stable
Are you sure you want to change the base?
Conversation
Rather than making custom commands to simply copy files in place we can depend on cmake' configure_file() command to do the right thing for us. That is configure_file() will track any file changes for us and automatically copies the updated files to where we told it initially. This change requires an explicit rerun of cmake!
@CWehli That's because it's independent of the target: "If the input file is modified the build system will re-run CMake to re-configure the file and generate the build system again. The generated file is modified and its timestamp updated on subsequent cmake runs only if its content is changed.". Buildsystem (meaning ninja here) targets don't apply to cmake. |
@gjanssens had a lot of comments on #234, and @usamimikamen-sk ultimately abandoned the PR and deleted their branches. Can you be a bit more specific about what is the goal of this PR? |
|
@CWehli ping? |
|
@jralls: |
|
I only noticed this PR now. I'll look at it later this weekend (which is unfortunately probably too late for the upcoming release). |
|
@gjanssens Don't worry about the release, this is just about building anyway. |
|
Ok, I had some time to think this over. In hindsight my comment on #234 did not offer the ideal solution either. At the time I missed the fact that So there's a choice to make here:
So if I look back at this today, I personally would keep using a custom command to copy target-specific static files such as figures. I should also clarify that my issue with the code in #234 was really the use of a dummy output file ( |
|
Another thing I have changed my mind on since that closed PR is the use of While very convenient, it won't track adding new files in that directory. So if someone adds a new figure, that will not be noticed by the build system until the cmake cache is cleared. Cmake scripts are usually written in such a way that clearing the cmake cache is hardly ever necessary, so requiring this to add a new figure is a confusing thing to do, not only for the person adding the image, but also for all others that have existing checked out projects pulling in the change. It's slightly more cumbersome, but better to explicitly state all files you need. That's why we have lists of figures for each document in each language. At the time I wrote the cmake scripts for gnucash-docs I took a lazy shortcut for the stylesheet icons, figuring we never add one there anyway. That's likely the case but may not absolutely be so. It would be cleaner to also explicitly define a variable with a list of icons to copy. Considering these change that rarely, I don't consider that too important. That list by the way should probably be defined in a cmake file somewhere in the stylesheet directory rather than in the cmake_HTML target. |
I took up some ideas from @usamimikamen-sk's #234 and, based on @gjanssens' comments, tried to make copying files as a “custom_command”.
I start the build with the command
cmake -G Ninja -S ../src -D CMAKE_INSTALL_PREFIX=..install -D WITH_HTML_INSTALL=ON, which copies all files to the build directory for each languages.However, I could not figure out how to control the dependency between build and the copying of the files during the installation of a single component, with e.g.
ninja de-html && ninja install de-html.All files are always copied, even for the languages that are not activated.