Skip to content
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

Layout set_property("cmake_build_modules") #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

memsharded
Copy link

No description provided.

@@ -33,13 +33,7 @@ install(
DESTINATION visualizers
)

file(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the issues is that the same file with the fixed path cannot work for 2 different layouts, the "build/editable" layout, and the "package" layout.

I moved this to the "source" tree, so I could keep the same relative position of the add_visualizers.cmake file and the lib.natvis file. Another strategy would be to have different files: one file written at "build" time, but then, do not copy that file as-is to the package folder at install() time but instead generate a new one with an updated relative position.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't quite solve my problem, because now I have to define the add_visualizers.cmake script manually. Instead I would like to automate the process. That was what the CMake script file invocation represents. In reality the scripts to generate it are somewhat more involved. I can generate the file using Conan too if that's more appropriate, but it seemed to me that I probably shouldn't generate files in package_info.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guessed that the process could be more complicated, this is why I suggested the above. The main issue is that the relative path between the add_visualizers.cmake and the nat.vis file should be correct in both places, and this cannot happen if you use exactly the same file copied at install() time. So the automated solution, if you want to support both the create and the editable different layouts, would be to make sure that 2 different files are generated:

  • One add_visualizers.cmake that you create at build() time, with the relative path in the "build" or editable layout
  • Another add_visualizers.cmake that you create at package() time, with the relative path of the "package" layout
  • It is not necessary to create the files in package_info() only in build() and package()
  • If it is easier, the add_visualizers.cmake could be "patched" at package() time, doing a copy to the package folder, then patching the relative paths (it could be already an easy to patch variable that is reused in the script)

Please let me know if this helps.

@@ -0,0 +1,2 @@
message(STATUS "Adding target_sources() in add_visualizers.cmake")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this here, so the relative position of add_visualizers.cmake and nat.vis was the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants