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

CMake: Check for multi-config generator is wrong #1574

Closed
DenizThatMenace opened this issue Sep 15, 2023 · 0 comments · Fixed by #1575
Closed

CMake: Check for multi-config generator is wrong #1574

DenizThatMenace opened this issue Sep 15, 2023 · 0 comments · Fixed by #1575

Comments

@DenizThatMenace
Copy link

In CMakeLists.txt you are checking if a multi-config generator is present, by examining a variable GENERATOR_IS_MULTI_CONFIG. (See: https://github.com/zlib-ng/zlib-ng/blob/develop/CMakeLists.txt#L60)

However, that is not how this works. There is no variable GENERATOR_IS_MULTI_CONFIG defined by CMake by default.
Instead, there is a global CMake property of that name defined. (See: CMake documentation
And a property first has to be retrieved and stored into a variable before it can be further examined.

So you need to add the following code before the line where you check the value of the variable GENERATOR_IS_MULTI_CONFIG:

get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)

Thereby you are retrieving the value of the global CMake property GENERATOR_IS_MULTI_CONFIG and store it in a local variable of the same name.
Then the following code lines work as expected.

DenizThatMenace added a commit to DenizThatMenace/zlib-ng that referenced this issue Sep 15, 2023
CMake does not define a variable GENERATOR_IS_MULTI_CONFIG by default.
Instead it sets a global property of that name.
In order to examine its value it first has to be retrieved and stored
into a (local) variable, which is what this commit does.

fixes: zlib-ng#1574

Signed-off-by: Deniz Bahadir <deniz@code.bahadir.email>
Dead2 pushed a commit that referenced this issue Sep 16, 2023
CMake does not define a variable GENERATOR_IS_MULTI_CONFIG by default.
Instead it sets a global property of that name.
In order to examine its value it first has to be retrieved and stored
into a (local) variable, which is what this commit does.

fixes: #1574

Signed-off-by: Deniz Bahadir <deniz@code.bahadir.email>
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 a pull request may close this issue.

1 participant