CMake is a great tool, but I always keep searching on how to do this and that. Time to make a list again…
Checking the G++ compiler version:
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE G++_VERSION)
if (G++_VERSION VERSION_LESS 4.7)
message(SEND_ERROR "You need at least G++ 4.7 to compile!")
endif()
Appending entries to a list:
LIST(APPEND
bla.h
)
Creating filters in Visual Studio projects:
source_group("" REGULAR_EXPRESSION \\/.*)
Custom install commands
To print a message during the install process add:
install(CODE "MESSAGE(\"Casting spell\")")
To run a shell command during the install process add:
install(CODE "execute_process(COMMAND 'echo Creating magic')")