Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
反映典型目录结构的简单CMakeLists.txt(/src、/inc、/bin子目录)_Cmake - Fatal编程技术网

反映典型目录结构的简单CMakeLists.txt(/src、/inc、/bin子目录)

反映典型目录结构的简单CMakeLists.txt(/src、/inc、/bin子目录),cmake,Cmake,我正在努力创建一个CMakeList.txt文件来反映一个简单、典型的makefile。原件在这里 我尝试了很多方法(比如SET(SOURCE…)和SET(HEADERS…)来添加/src、/lib和/third-party//include),但都没有成功 任何人都可以帮我解决问题,或者指向一个做这件事的教程吗?这只是一个出人意料的框架-有关每个功能的详细信息,请参阅: cmake_minimum_required(VERSION 2.6) # Project name, can be use

我正在努力创建一个CMakeList.txt文件来反映一个简单、典型的makefile。原件在这里

我尝试了很多方法(比如SET(SOURCE…)和SET(HEADERS…)来添加/src、/lib和/third-party//include),但都没有成功


任何人都可以帮我解决问题,或者指向一个做这件事的教程吗?

这只是一个出人意料的框架-有关每个功能的详细信息,请参阅:

cmake_minimum_required(VERSION 2.6)
# Project name, can be used as target name too
project(Example)

# Search all .cpp files within src - recursive!
# You can add all source files by hand here too
file(GLOB_RECURSE SRCS "src/*.cpp")

# Add include path (you can also add it's sub directories
include_directories("include")

# Search for packages -- PLEASE NOTE: many libraries provide alternative's to this
# which often provide more functionality
find_package(PkgConfig REQUIRED)
# TODO: add proper pkg modul search info's and change the variable's name
pkg_search_module(PACKAGE_NO1 ...)

# Show some messages (optional)
if( (PACKAGE_NO1 )
    include_directories(${(PACKAGE_NO1_INCLUDE_DIRS})
    message(STATUS "Using OpenSSL ${(PACKAGE_NO1_VERSION}")
else()
    # do error handling
endif()

# Add compiler flags
add_definitions(-std=c++11 -Wall) # -g O3 etc are added according to Release / Debug compilation

# Build a executable target (1st param: Target name; 2nd: source files)
add_executable(${PROJECT_NAME} ${SRCS})