Reputation: 1018
For some reason CMake generates a buggy makefile:
make[2]: *** No rule to make target `CMakeFiles//Users/wen/projects/Space Cubes/src/Debug.cpp.dir/depend'. Stop.
make[1]: *** [CMakeFiles/Users/wen/projects/Space Cubes/src/Debug.cpp.dir/all] Error 2
What's happening here and why can't it work? I have tried clearing caches already.
CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project(spacecubes)
if (APPLE)
FIND_LIBRARY(OPENGL_LIBRARY OpenGL)
FIND_LIBRARY(GLUT_LIBRARY GLUT)
SET(EXTRA_LIBS ${OPENGL_LIBRARY} ${GLUT_LIBRARY})
else (APPLE)
target_link_libraries(${PROJECT} gl glu glut)
endif(APPLE)
file(GLOB_RECURSE src "src/*.cpp")
add_executable(${PROJECT} ${src})
Upvotes: 1
Views: 823
Reputation: 1214
It was posted years ago and I wanna say I am suffering the same issue when I try to use add_executable and add_library at the same time.... I am looking for the solution as well.
cmake version: 2.8.7 system: Ubuntu 12.04
Update:
Hi, I am back here to answer the question.
The problem happens because the executable and lib have the same target name, in your case, it's ${project}, so cmake generates some bug code in the makefile.
In addition for Apple system, Apply use the case-insensitive file system by default, so if you use same name with different upper or lower case, it will end with the same error.
Upvotes: 2
Reputation: 709
This should fail when you generate the project.
${PROJECT} should be empty. I don't see where you are defining it.
add a line set(PROJECT "spacecubes") and it should build fine.
Upvotes: 0