Git Product home page Git Product logo

clion-vs-vcpkg-config's Introduction

本project测试在clion和visual studio中联合使用cmake和vcpkg的方法。这个project既可以在clion中运行,也可以在visual studio中运行。(2024年5月17日)

clion中使用vcpkg的方法

https://github.com/microsoft/vcpkg

  1. 视图 - 工具 - Vcpkg。点击后vcpkg会在底部左侧显示。通过垃圾桶标志可以删除多余的库。
  2. 把vcpkg的路径设为c盘,比如C:/vcpkg/scripts/buildsystems/vcpkg.cmake
  3. 在CMakeLists.txt中加入set(CMAKE_TOOLCHAIN_FILE "C:/vcpkg/scripts/buildsystems/vcpkg.cmake")
  4. 由于MinGW包经常遇到不兼容的问题,所以把编译器设为Visual Studio
  5. 设置CMake选项 -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake 。注意这里必须用反斜杠,正斜杠因为是转义会报错。(第三步设置CMAKE_TOOLCHAIN_FILE路径后, 这里不设置也可以)
  6. 使用vcpkg下载软件包选择x64-windows版本。Mingw-dynamic版本可能是兼容性问题总是链接失败。当然,把编译器设置为visual studio后vcpkg下载的判断默认就是x64-windows版了。(2024年5月15日)
  7. 果然,clion还是要复制fmtd.dll的(因为在C:\gitcloud\clion-vcpkg-config\cmake-build-debug找到了fmtd.dll文件),只不过clion把这个过程自动化了。(2024年5月17日)

visual studio中联合使用cmake和vcpkg的方法

  1. 在labpc上,vcpkg的环境变量不用专门设置也不影响visual studio跑相关程序。(2024年5月17日)
  2. 启动项选择:如果当前文档CMakeLists.txt不行,就换成learn.cpp; 如果learn.cpp不行,就换成CMakeLists.txt。(2024年5月17日)
  3. set(CMAKE_PREFIX_PATH "C:/vcpkg/installed/x64-windows")。(2024年5月17日)

clion-vs-vcpkg-config's People

Contributors

ssfc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.