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

How to install #4

Closed
dietergovaerts opened this issue May 28, 2020 · 4 comments
Closed

How to install #4

dietergovaerts opened this issue May 28, 2020 · 4 comments

Comments

@dietergovaerts
Copy link

Hi,

Your project seems exactly what we need at first glance!

Could you provide some information as to how to install your package such that cmake can find it? Can I put it in my project repository and point cmake with some setting to it or do I need to place it at some specific location?

It will need to work for Windows, Linux and Mac.

Thanks!

Dieter

@katusk
Copy link
Owner

katusk commented May 28, 2020

Hi Dieter, good to hear! 😃 Hope it will prove useful for you.

No specific location is required.

In my (current) view, CMakeNuGetTools is an intrinsic part of the build scripting of my CMake-based C/C++ projects, and as such it is simply present in my project repositories as a copy. For example, I have the contents of the cmake/ directory of this CMakeNuGetTools repository simply copied over to scripts/CMakeNuGetTools/ in internal projects at my company. (Every other script file in the CMakeNuGetTools repository is for only stand-alone testing. Sidenote: one day I want to automate those tests.)

Then, in the root CMakeLists.txt of those projects, I can simply write

include("${CMAKE_CURRENT_LIST_DIR}/scripts/CMakeNuGetTools/NuGetTools.cmake")

before calling any of the nuget_* functions. NuGetTools.cmake currently includes all other required CMake scripts. I only call nuget_initialize, nuget_add_dependencies, nuget_generate_nuspec_files, and some helper functions from CMakeLists.txt files currently (e.g. see test project subdirectories under tests/ in this repository). Calling nuget_merge_nuspec_files and nuget_pack is done outside of CMakeLists.txt files from stand-alone CMake script files on top of those driving the build system generation, triggering the actual build and install of the project etc (see CMakeLists.pack.cmake as a simple example in the root directory of this repository).

So no other "installation method" than copying is used by me currently. Do you have any other means of installation in mind? For example, do you want to directly track changes of the cmake scripts found in the CMakeNuGetTools repository?

I guess I should update the README.md with some explicit setup information. I also want to create separate repositories for example projects showcasing the use of CMakeNuGetTools in the future.

Oh, and before I forget: do not forget to provide a value for the NUGET_COMMAND cache variable whenever you invoke any nuget_* functions, otherwise most of those error out, or print a warning. For me, it is set by passing -DNUGET_COMMAND=nuget for the CMake executable.

This is fine, if you have the nuget.exe in your PATH on Windows. For other platforms, e.g. on Linux, one should have an alias nuget as you can see at https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools#macoslinux, and then -DNUGET_COMMAND=nuget should be fine if you got past setting up mono and nuget.exe on a Linux system. Always test your Linux NuGet CLI setup first by running a nuget install at the terminal by hand.

You are welcome!

PS One might also use CMake's find_program for setting NUGET_COMMAND -- I have never tried this before particularly for the NuGet CLI.

@katusk
Copy link
Owner

katusk commented May 28, 2020

Could you provide some information as to how to install your package such that cmake can find it?

PPS Hmm, hope I did not misunderstand you. I interpreted "package" as the list of CMake scripts found in this repository, and answered accordingly in my previous comment.

@dietergovaerts
Copy link
Author

Could you provide some information as to how to install your package such that cmake can find it?

PPS Hmm, hope I did not misunderstand you. I interpreted "package" as the list of CMake scripts found in this repository, and answered accordingly in my previous comment.

That is exactly what I meant. With the information you provided I should be able to start with your package in our project.

Thanks!

Dieter

@katusk
Copy link
Owner

katusk commented May 29, 2020

Cool; you are welcome! Feel free to contact me if you have any other questions. Cheers, Kristóf

katusk added a commit that referenced this issue Jun 1, 2020
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

No branches or pull requests

2 participants