CMake入门——SET命令

CMake中最重要的编写CMakeLists.txt文件。本文不介绍常用命令,只是整理记录自己编写中的小问题。

以下面CMakeLists.txt为例

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)
SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
SET(VTK_DIR E:/Thirdparty/x64/VTK)

project(RenderCylinder)

INCLUDE_DIRECTORIES(
    ${VTK_DIR}/include/vtk-6.0
)
LINK_DIRECTORIES(
    ${VTK_DIR}/lib/${ConfigurationName}
)
add_executable(${PROJECT_NAME} RenderCylinder.cpp RenderCylinder.h)

target_link_libraries(${PROJECT_NAME}
	vtkFiltersGeometry-6.0
	vtkIOGeometry-6.0
	vtkIOCore-6.0
	vtkCommonCore-6.0
	vtkInteractionStyle-6.0
	vtkRenderingOpenGL-6.0
	vtkCommonDataModel-6.0
	vtkfilterscore-6.0
	vtkRenderingCore-6.0
	vtkCommonExecutionModel-6.0
	vtkFiltersSources-6.0
)

命令SET(VTK_DIR E:/Thirdparty/x64/VTK)用来定义变量VTK_DIR,并赋值E:/Thirdparty/x64/VTK,表示VTK路径。

该行命令还可以写成如下两种形式

SET(VTK_DIR "E:/Thirdparty/x64/VTK")
#或者
SET(VTK_DIR E:\\Thirdparty\\x64\\VTK)

 

你可能感兴趣的:(CMake)