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

[Windows] Macro _conan_detect_build_type doesnt work with Visual Studio IDE #322

Closed
Sneder89 opened this issue Mar 4, 2021 · 5 comments · Fixed by #325
Closed

[Windows] Macro _conan_detect_build_type doesnt work with Visual Studio IDE #322

Sneder89 opened this issue Mar 4, 2021 · 5 comments · Fixed by #325
Assignees
Labels
Milestone

Comments

@Sneder89
Copy link
Contributor

Sneder89 commented Mar 4, 2021

Hello everybody!

when I invoke conan_cmake_autodetect with Visual Studio IDE, the function returns inside the macro _conan_detect_build_type an error message because CMAKE_BUILD_TYPE is not defined. Multi Configuration IDE's like VS or XCode doesn't set the Variable CMAKE_BUILD_TYPE but CMAKE_CONFIGURATION_TYPES.

A solution could be that the Variable CMAKE_CONFIGURATION_TYPES is getting evaluated too after CMAKE_BUILD_TYPE and the corresponding settings are getting adapted.

@Nekto89
Copy link

Nekto89 commented Mar 11, 2021

I have the same issue. Had to switch to conan_cmake_run

@czoido czoido self-assigned this Mar 11, 2021
@czoido
Copy link
Contributor

czoido commented Mar 15, 2021

Hi @Sneder89, @Nekto89,
Thanks a lot for reporting the issue, I have reproduced it. We'll try to fix this as soon as possible.

@czoido czoido added bug and removed bug labels Mar 15, 2021
@czoido czoido added this to the 0.17 milestone Mar 15, 2021
@czoido
Copy link
Contributor

czoido commented Mar 15, 2021

Hi @Sneder89, @Nekto89

Having a more close look at the issue, I think this is how it should work and the CMAKE_CONFIGURATION_TYPES and CMAKE_BUILD_TYPE should be handled from the consumer CMakelists.txt.
In the old flow using conan_cmake_run for Multi Configuration generators would call several times to conan install but as now we are decoupling and separating this behaviours and make it more aligned with conan commands calls we can't handle this from the inside of conan.cmake.
I have added a test to check this works: https://github.com/conan-io/cmake-conan/pull/325/files#diff-f455f302936271d755f6892d443786094d2607b505ff180ca817cb9eeabe1e5eR941-R964
Will this help to solve the problem?

@Sneder89
Copy link
Contributor Author

Hi @czoido,

this helps and solves my problem. But I agree that its complicated to have manually set CMAKE_BUILD_TYPE to use the conan_settings_autodetect function.

@czoido
Copy link
Contributor

czoido commented Mar 22, 2021

Hi @Sneder89,
I have made some changes so that conan_cmake_autodetect cane be called with the BUILD_TYPE argument so it's more explicit.

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

Successfully merging a pull request may close this issue.

3 participants