Relative Content

Tag Archive for cmake

CMake – Generator Expression

I am building a source file using “add_custom_command”. The compiler is MS Visual Studio. CMake version is 3.29. I am trying to get the intermediate object file directory using the generator expressions, and to set it as the working directory as shown below.

Set the _VERSION_MAJOR, _VERSION_MINOR

I have a simple find_package(pack 1.0.0 REQUIRED EXACT) in top level CMakeLists.txt
Now, I want to give a specific format like MAJOR.MINOR.PATCH/TWEAK and set these variables using find_package. How can I do this?
I read cmake documenatation about _MAJOR_VERSION etc but could not get an example or details on my specific scenario: https://cmake.org/cmake/help/latest/command/find_package.html#version-selection