To answer your direct question, here is the relevant portion of GenerateBinaryVersion.cmake. Project(cmake-binary-versioning LANGUAGES NONE)ĭESTINATION share/cmake/GenerateBinaryVersion CMakeBinaryVersioning/CMakeLists.txt: cmake_minimum_required(VERSION 3.25) Project(company-CMakeModules LANGUAGES NONE)Īnd the contents of. The cmake project file that contains the cmake module looks like this: cmake_minimum_required(VERSION 3.25) I’m at my PC now so let me share a little bit of the code: I’ve been searching for hours and rereading the book trying to figure this out. This is for my job, so I can’t really post too much detail. What am I doing wrong? What is the right way to achieve this? I would love it if my modules were consumable as installed (packaged zip), by fetch content, and by external project, but I will accept only fetch content or only external project if it works well. Then the calling scope would add these to the target include directories and my dll gets built with version meta data.īut as I said before, I cannot generate the configured files because they are located relative to the cmake module itself (and part of that module’s git repo). In order to achieve this, there are two template files which are processed by configure_file and which generate a version.h and a versionresource.rc file, then adds the path to those generated files into a list variable provided to the function. I currently have one module which has a function used to generate windows dll/exe version properties. Maybe there is a way to get the path to these files once my module subdirectory is added (but how)? But I also don’t want to do that because it would clutter my source tree with module files. However, my module’s functions don’t actually work because the files that the function requires are buried deep inside the cmake build structure and I don’t know how to trigger an install to deliver the files to the local project scope. I have achieved bringing this into another project using the Fetch Content pattern presented by Craig Scott in his book (and likely by others too). Open the newly created folder in Visual Studio.I have been attempting to setup a git repository that will contain cmake modules. In this case, you should create an empty main.c, main.cpp or Program.cs file next to the CMakeLists.txt.ġ. Message (STATUS "[$)Īlternatively, you can create an empty folder, copy the CMakeLists.txt file and customize the project name. If desired, adjust the folder name and project name in the CMakeLists.txt file.Ĭmake_minimum_required(VERSION 3.2 FATAL_ERROR) the folder "/ids_peak/comfort_sdk/samples/source/c/walkthrough/" (comfortC) or "./ids_peak/generic_sdk/samples/source/cpp/open_camera/" (genericC++) into your working directory. Start with a pre-configured CMakeLists.txt file from the examples. Select the appropriate Visual Studio version. This way, you can open folders with a CMakeLists.txt file directly via "File > Open > Folder". The CMake support is directly integrated since Visual Studio 2017. Opening a C-Make project folder directly (from Visual Studio 2017 on) Configuring a Visual Studio project folder manually.Creating a Visual Studio project folder with CMake GUI (all Visual Studio versions).Opening a C-Make project folder directly (from Visual Studio 2017 on).If you use Visual Studio, you have several options to create a project:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |