1.源码目录结构
TestProject
+------include //存放.h头文件
+------src //存放.c/.cpp源文件
+------CMakeLists.txt
2.编写CMakeLists.txt内容
cmake_minimum_required(VERSION 2.8)
#project name
PROJECT(testUrl)
#set charset
add_definitions(-DUNICODE -D_UNICODE)
#header file path
INCLUDE_DIRECTORIES(include)
#set include files variable
SET(DIR_INCS
include/stdafx.h
include/targetver.h
)
#set source files variable
SET(DIR_SRCS
src/stdafx.cpp
src/testUrl.cpp
)
#set external linking library
SET(LIBRARIES libcurl.lib)
#add project executable path
ADD_EXECUTABLE(testUrl ${DIR_SRCS} ${DIR_INCS})
#add linking library
TARGET_LINK_LIBRARIES(testUrl ${LIBRARIES})