How do I add an existing C++ sSource file to a CLion Project

I created a simple cmake project in Clion. I need to add existing source files from another directory. How do I do that ???

The project table only allows we to add a new source ( and it updates CMakeFile.txt ). Also why does it add the header files to the source list ??

6 comments
Comment actions Permalink

Are you trying to do an out of source build for some dependency?

0
Comment actions Permalink

This'll work for that.

 

add_subdirectory(/path to directory/ ${CMAKE_CURRENT_BINARY_DIR}/tinyxml2-3.0.0)
1
Comment actions Permalink

Please see the attached image, I am trying to add an existing file to this project called "intro"

0
Comment actions Permalink

In that case just drop it in the folder and add it to SOURCE_FILES.

0
Comment actions Permalink

could you describe how you add it to SOURCE_FILES...

1
Comment actions Permalink

once i added mingw path, i got it working

0

Please sign in to leave a comment.