Giter Club home page Giter Club logo

cmake_sampler's Introduction

  • CMAKE_CURRENT_SOURCE_DIR:当前正在处理的源目录的路径.
  • CMAKE_SOURCE_DIR: 最外层CMakeLists.txt所在目录

按文件类型修改默认输出路径 CMake 提供了一些预定义的变量来控制不同类型文件的默认输出路径,常见的有:

  • CMAKE_ARCHIVE_OUTPUT_DIRECTORY 表示静态库的默认输出路径
  • CMAKE_LIBRARY_OUTPUT_DIRECTORY 表示linux上动态库(*.so)的输出路径
  • CMAKE_RUNTIME_OUTPUT_DIRECTORY 表示可执行程序,以及windows上动态库(*.dll)的输出路径
  • CMAKE_PDB_OUTPUT_DIRECTORY 表示MSVC环境下pdb文件的输出路径

修改target的输出路径

  • ARCHIVE_OUTPUT_DIRECTORY
  • LIBRARY_OUTPUT_DIRECTORY
  • RUNTIME_OUTPUT_DIRECTORY
  • PDB_OUTPUT_DIRECTORY
add_executable(abc main.cpp)
set_target_properties(abc PROPERTIES 
    RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")

add_library(foo SHARED foo.cpp foo.h)
set_target_properties(foo PROPERTIES 
    RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin"
    LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")

设置编译器

set (CMAKE_C_COMPILER "D:/Program Files/LLVM/bin/gcc")
 
set (CMAKE_CXX_COMPILER "D:/Program Files/LLVM/bin/g++")

cmake_sampler's People

Watchers

HaoShuai 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.