/usr/lib/ld cannot open output file unit_test: is a directory
<p>I have a problem while programming an Asteroid-like videogame in C++ for an exam I will have in a few days. I'm using a JetBrains CLion 1.3 IDE. When I try to implement a unit test with GoogleTest framework (version 1.7.0), I get this error by the compiler:</p>

<pre><code>[ 40%] Built target core
[ 80%] Built target asteroids
[ 85%] Built target gtest
[ 87%] Linking CXX executable unit_test
/usr/bin/ld: impossibile aprire il file di output unit_test: È una directory
collect2: error: ld returned 1 exit status
CMakeFiles/unit_test.dir/build.make:95: set di istruzioni per l'obiettivo "unit_test" non riuscito
make[2]: *** [unit_test] Errore 1
CMakeFiles/Makefile2:104: set di istruzioni per l'obiettivo "CMakeFiles/unit_test.dir/all" non riuscito
make[1]: *** [CMakeFiles/unit_test.dir/all] Errore 2
make[1]: *** Attesa per i processi non terminati....
[ 91%] Built target gtest_main
Makefile:127: set di istruzioni per l'obiettivo "all" non riuscito
make: *** [all] Errore 2
</code></pre>

<p>What I want to ask is about the line:</p>

<p><code>/usr/bin/ld: impossibile aprire il file di output unit_test: È una directory</code></p>

<p>translated from italian, it means (literally):</p>

<p><code>/usr/bin/ld: cannot open output file unit_test: Is a directory</code></p>

<p>What's wrong with my code? I suppose it's a CMakeLists.txt problem, so here are my CMakeLists.txt files (one from the main directory, the other from the "test subdirectory"):</p>

<p><strong>Main Directory CMakeLists.txt</strong> (part regarding the googletest build):</p>

<pre><code>add_subdirectory(test)

add_executable(unit_test main.cpp)
add_library(core ${SOURCE_FILES})
target_link_libraries(unit_test core)
</code></pre>

<p><strong>Test Directory CMakeLists.txt</strong> (full):</p>

<pre><code>add_subdirectory(googletest)
set(gtest_SOURCE_DIR, googletest)
include_directories(${gtest_SOURCE_DIR}/include
        ${gtest_SOURCE_DIR})

set(SOURCE_FILE runAllTests runAllTests.cpp AsteroidFixture.cpp)
add_executable(runAllTests ${SOURCE_FILE})
target_link_libraries(runAllTests gtest gtest_main core)
</code></pre>

<p>I created the AsteroidFixture.cpp file as a first try for the main gtest functions, but it's essentially an empty file.</p>