Reputation: 31851
What is the correct way to test if the compiler is GCC under Cmake?
I've seen both if(CMAKE_COMPILER_IS_GNUCC)
and if(CMAKE_COMPILER_IS_GNUXX)
but neither of those are defined when I run cmake. Just to be clear, I'm 100% sure I'm using GCC.
I just want to add compiler flags specific to GCC. Previously I just used an else
clause after a check fro windows, but I want to be more generic now.
Upvotes: 3
Views: 4345
Reputation: 31851
I think I found the problem. Those properties aren't defined until after the project
statement. Switching the ordering around and it appears to work.
Upvotes: 3