I wonder what are the restrictions on using CMake files (I guess, especially using subdirectories and/or libraries, as well as the location of the executables)
(When I use the trivial Hello example, KDevelop works fine, I can even debug my project. When I attempt to approach it to my real target project, and I edit the CMakeList.txt file to create library in a subdirectory, and move the executables in a separate subdirectory, KDevelop gets partially working: it builds the executables, the executables work in stand-alone mode, but not under KDevelop, and of course I cannot debug.)
I guess that some kind of visibility problem is happening: i.e. although CMake thinks my arrangement is OK (i.e. produces correct Makefile and even the executables), somehow KDevelop gets lost, and since it does not see some file at the place it expects, it stops working. Is there any rule set, what NOT to use in CMake?
For any case I attach my cmake files (the main one and the one for the library). Do I make something wrong?
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
project(kmanycore CXX C)
include_directories(../lib)
add_subdirectory(lib)
add_executable(../bin/kmanycore ../src/main.cpp)
add_executable(../bin/kmanycore_test ../src/main_test.cpp)
target_link_libraries(../bin/kmanycore manycore)
target_link_libraries(../bin/kmanycore_test manycore)
and
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
add_library(manycore src/ToDo.cc)
Your CMake file looks weird, and I am not an IDE.
The first argument of
add_executable
is the name of the executable, no path. It works by change with plain Makefiles. Same withtarget_link_libraries
. And it is unclear who the two projects are related to each other. Usually IDEs keep track of single project; interweaved ones are not supported.