CMake生成的Makefile不包含目标

时间:2016-03-25 12:08:31

标签: cmake

我使用G ++ MinGW进行编译。我的档案:

  

main.cpp,linkedList.cpp,linkedList.h

我的CMake文件:

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
project (Tutorial)
set(CMAKE_CXX_FLAGS "-Wall -std=c++11")
enable_testing()

include_directories(include)
add_executable(Tutorial 
main.cpp
linkedList.cpp
linkedList.h
)

add_test(Tutorial tutorial)

生成的Makefile中的确切编译错误:

mingw32-make[2]: *** No rule to make target '../linkedList.h', needed by 'CMakeFiles/Tutorial.dir/main.cpp.obj'.  Stop.
mingw32-make[1]: *** [CMakeFiles/Tutorial.dir/all] Error 2
mingw32-make: *** [all] Error 2

Gist for CMake generated Makefile

1 个答案:

答案 0 :(得分:1)

您的定位是Tutorial,而不是../LinkedList.h

转到构建目录并执行

make Tutorial