should CMake add_executable include header files?

Viewed 1627

I'm pretty new to CMake, and my question is:

say we have a simple project with only

main.cpp

that uses

header.h

And i want to build this project using CMake, so i have a minimal
CMakeLists.txt that only contains the following (only what's relevant):

add_executable(MyApp main.cpp)

Is there a reason to include the header.h in the CMakeLists.txt?

From what i've seen, if i modify the header.h and run cmake again,
it update as expected.

1 Answers

should CMake add_executable include header files?

I don't know if this applies to all compilers, but as far as GCC/Clang are concerned: It doesn't matter. You don't need to, but it doesn't break anything if you do.

Related