Comments (8)
@gary-desroches this appears to be a bug specific to building docopt.cpp on MSVC/Clang configuration. Have you been able to resolve this problem since you reported it?
from gui_starter_template.
@lefticus I managed to get the build process working on my Windows setup using MSVC/Clang. Unfortunately I'm pretty new to C++ and CMAKE and I don't have a proper solution for this but maybe this info can help someone more knowledgeable address this.
From what I could tell it seems that CMAKE_COMPILER_ID, which is "Clang" under these conditions results in a misconfiguration in build/conan.cmake around lines 154 and 174 which looks to be expecting the CMAKE_COMPILER_ID to be MSVC. I don't know if this is Conan making an incorrect assumption or some issue in this setup.
I managed to get everything building fine by setting the CMAKE_CXX_COMPILER_ID to MSVC and CMAKE_CXX_GENERATOR_TOOLSET to ClangCL before Conan.cmake invokes conan.cmake/conan_cmake_run() and it results in conan generating a working batch of settings that look something like this:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=Visual Studio
compiler.runtime=MDd
compiler.toolset=ClangCL
compiler.version=16
os=Windows
os_build=Windows
[options]
[build_requires]
[env]
I do revert the CMAKE_COMPILER_ID and CMAKE_GENERATOR_TOOLSET after this call but because I'm pretty clueless about most of this I'm not sure what the repercussions would be. I'm don't know if any of this is useful but hopefully someone here has an idea how this should be fixed up correctly.
from gui_starter_template.
For my own purposes I have worked around this by checking against these variables and modifying the cmake/Conan.cmake file to look something like this:
set (PROJECT_IS_MSVC_CLANG (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND ${CMAKE_CXX_COMPILER_FRONTEND_VARIANT} STREQUAL "MSVC"))
if (PROJECT_IS_MSVC_CLANG)
set(PREV_CMAKE_CXX_COMPILER_ID ${CMAKE_CXX_COMPILER_ID})
set(PREV_CMAKE_CXX_GENERATOR_TOOLSET ${CMAKE_CXX_GENERATOR_TOOLSET})
set(CMAKE_CXX_COMPILER_ID MSVC)
set(CMAKE_CXX_GENERATOR_TOOLSET ClangCL)
endif ()
conan_cmake_run(
REQUIRES
${CONAN_EXTRA_REQUIRES}
catch2/2.13.3
docopt.cpp/0.6.2
fmt/6.2.0
spdlog/1.5.0
OPTIONS
${CONAN_EXTRA_OPTIONS}
BASIC_SETUP
CMAKE_TARGETS # individual targets to link to
BUILD
missing)
if (PROJECT_IS_MSVC_CLANG)
set(CMAKE_CXX_COMPILER_ID ${PREV_CMAKE_CXX_COMPILER_ID})
set(CMAKE_CXX_GENERATOR_TOOLSET ${PREV_CMAKE_CXX_GENERATOR_TOOLSET})
endif ()
Probably a horrendous hack but it works for me until the conan packages handle this correctly.
from gui_starter_template.
Has anyone tried the fix proposed in #122 for this problem? I don't know if it works, but it looks a little cleaner.
I'm not able to reproduce this problem myself, otherwise I would try the fix.
from gui_starter_template.
Has anyone tried the fix proposed in #122 for this problem? I don't know if it works, but it looks a little cleaner.
I'm not able to reproduce this problem myself, otherwise I would try the fix.
I tried it, and I got the following error upon configuring.
Conan executing: C:/Program Files/Conan/conan/conan.exe install . -s build_type=Release -s compiler=clang -s compiler.version=11 -s compiler.libcxx=libc++ -e=CC= -e=CXX=C:/Program Files/LLVM/bin/clang-cl.exe -e=catch2/2.13.3 -e=docopt.cpp/0.6.2 -e=fmt/6.2.0 -e=spdlog/1.5.0 -g=cmake_multi --build=missing
ERROR: Invalid input 'catch2/2.13.3', use 'name=value'
Also, is this just setting environment variables to Clang? Setting them is a part of the instructions, so I already have them.
Edit: Actually, I had CC and CXX not the CMAKE_ versions. I set them as environment variables and tried again. I get the same errors, even the ones saying I'm missing those.
from gui_starter_template.
@gary-desroches this appears to be a bug specific to building docopt.cpp on MSVC/Clang configuration. Have you been able to resolve this problem since you reported it?
Not yet.
from gui_starter_template.
Has anyone tried using Conan profiles (https://docs.conan.io/en/latest/reference/profiles.html)? This is one of the approaches frequently suggested by people in the Conan community who are having trouble building with a specific toolchain. I think you can use a Conan profile to mimic what @BrendonSmuts was doing, without adding any compiler-specific code to Conan.cmake.
You would need to pass the path to your profile into cmake_conan_run
:
conan_cmake_run(
...
PROFILE ${PATH_TO_USER_CONAN_PROFILE}
...
)
I think you can use PROFILE default
if the user doesn't have a Conan profile.
See https://github.com/conan-io/cmake-conan#profile and https://docs.conan.io/en/latest/using_packages/using_profiles.html for docs.
Edit: Whoops, seems like this is an ongoing issue with Conan and clang-cl, depending on the dependency you're building. According to this comment, (conan-io/conan#1839 (comment)), which includes a working clang-cl Conan profile, "some third-party Conan package recipes that we use haven't accounted for the possibility of compiler=clang
when os=Windows
".
from gui_starter_template.
I think we can close this issue now, as cpp-boilerplate-project has builds for windows/llvm
from gui_starter_template.
Related Issues (20)
- CI fails with "Detected a mismatch for the compiler version between your conan profile"
- Failure upon building the project on OSX HOT 3
- Showing up as the smaller cpp_boilerplate_project HOT 2
- Builds fail for CMake < 3.18 HOT 5
- publish docker image HOT 3
- Regex broken in clang format HOT 4
- build error on OSX HOT 1
- conan install fails due to zlib version conflict HOT 1
- PROJECT_IS_TOP_LEVEL in test/CMakeLists.txt is not set prior to CMake 3.21
- Env variables left in cache causes gcc-11 builds on ubuntu to fail HOT 5
- Doesn't work with openssl dependency HOT 5
- CI Failures on Ubuntu and Windows HOT 1
- Imgui examples.
- Doxygen was removed?
- Failing configuration with VS 2017
- why a template, want to clone to my machine HOT 1
- Conan error sdl/2.0.20
- Error with CLI library
- How to change LSAN variables HOT 1
- Using static constexpr in header file leads to duplication of data.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gui_starter_template.