Reputation: 9129
I am using CLion code editor. I have such structure of project:
This is the content of CMakeLists.txt:
cmake_minimum_required(VERSION 3.4)
project(FirstAgent)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.c)
add_executable(FirstAgent ${SOURCE_FILES})
target_link_libraries(FirstAgent simgrid)
But when I run my program in the code editor the error occur:
/usr/bin/ld: cannot open output file FirstAgent: Is a directory
collect2: error: ld returned 1 exit status
make[3]: *** [FirstAgent] Error 1
make[2]: *** [CMakeFiles/FirstAgent.dir/all] Error 2
make[1]: *** [CMakeFiles/FirstAgent.dir/rule] Error 2
make: *** [FirstAgent] Error 2
How can I avoid it?
Upvotes: 2
Views: 3074
Reputation: 4758
You can try setting an output directory, so that the binaries are stored elsewhere:
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
Upvotes: 4