lefticus / cpp_weekly_game_project

The Unlicense
107 stars 22 forks source link

Erros if PCH option is enabled in cmake #11

Open SaeidYazdani opened 4 years ago

SaeidYazdani commented 4 years ago

If I enable the PCH options in cmake then building the project fails. Any idea how can I get rid of this error? I tried to look into cmake documentation and it looks like there should be a way to exclude the "test" folder from being a target for precompiled headers?

saya@sayavbox:~/Work/cpp_base_project/build$ make
[  6%] Building CXX object test/CMakeFiles/catch_main.dir/catch_main.cpp.o
error: file '/home/saya/Work/cpp_base_project/build/test/CMakeFiles/catch_main.dir/cmake_pch.hxx.gch' is not a valid precompiled PCH file [clang-diagnostic-error]
error: input is not a PCH file: '/home/saya/Work/cpp_base_project/build/test/CMakeFiles/catch_main.dir/cmake_pch.hxx.gch' [clang-diagnostic-error]
1 warning and 3 errors generated.
Error while processing /home/saya/Work/cpp_base_project/test/catch_main.cpp.
Suppressed 1 warnings (1 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Found compiler error(s).
make[2]: *** [test/CMakeFiles/catch_main.dir/build.make:79: test/CMakeFiles/catch_main.dir/catch_main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:230: test/CMakeFiles/catch_main.dir/all] Error 2
make: *** [Makefile:95: all] Error 2