using CMake Part III – Build with Intel C++ Compiler

Intel C++ Compiler(ICL) offers very good compatibility with Microsoft Visual C++ Compiler(MSVC), however, they are not exactly the same.

We need to add at least one extra library to all project built with ICL, both user mode and kernel mode.

if(__WINDOWS_INTEL)
TARGET_LINK_LIBRARIES(${_target} libirc)
endif()

 

we also need to enforce to use /Zi for debug information, because CMake doesn’t set this option for ICL(actually, it also doesn’t set this for MSVC, but MSVC uses a file like VC12.pdb by default.)

foreach(item CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE)
set(${item} “${${item}} /Zi”)
endforeach()

For user mode applications(either exe or dll), we need to add one more library to allow linkers to work properly.

if(__WINDOWS_INTEL)
TARGET_LINK_LIBRARIES(${_target} libcmt$<$<CONFIG:Debug>:d> )
endif()

define these to override CMAKE_C_COMPILER,CMAKE_CXX_COMPILER

,’-DCMAKE_C_COMPILER=icl.exe’,’-DCMAKE_CXX_COMPILER=icl.exe’

fix MFC compilation error

modify afxmsg_.h:

find all WM_COMMAND+WM_REFLECT_BASE, change them to WM_COMMAND + WM_REFLECT_BASE

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s