We can use qmake to configure a project for different platforms after reading qt document, Qt 5 > qmake manual > Getting Started
.
The qmake syntax:
macx{ message("compile for mac os x") ICON = Images/logo.icns } win32{ message("compile for windows") RC_ICONS = Images/logo.ico }
Similarly, we can read the target system macro definition on CMake documentation and add settings on CMakeLists.txt to improve project compatibility.
CMake syntax:
if( WIN32 ) message( "This is windows platform" ) else( UNIX ) message( "This is Unix like system" ) if( APPLE ) message( "This is mac os x" ) endif() endif()