According to Why is cmake file GLOB evil?, using glob as a target sources is a bad practice. I've tried to produce the described situation.
CMakeLists.txt
file(GLOB SOURCES "src/*.cpp")
add_executable(main "${SOURCES}")
src/main.cpp
#include <iostream>
int main() {
return 0;
}
I am running cmake
once. After that I am creating an invalid cpp file src/test.cpp and running cmake
once more, followed by make
. According to situation described in the post I've to get everything compiled because cmake doesn't track this file. But in reality cmake does detect a change and compilation fails. Did I understand it wrong? I am using cmake version 3.17.1