[Cmake] Adding VC++ 6 Project Options to CMakeLists

Brad King brad . king at kitware . com
Mon, 16 Jun 2003 16:50:11 -0400 (EDT)


> I am using Intel C++ compiler with Visual Studio 6 and need to add
> /Zc:forScope to the project option. By looking at VTK CMakeLists, I
> guessed that CMake would generate a variable like
> VTK_REQUIRED_CXX_FLAGS, depending on the name of the project. So what I
> did is the following:
>
> PROJECT(Test)
> IF(WIN32)
> SET(Test_REQUIRED_CXX_FLAGS "${Test_REQUIRED_CXX_FLAGS} /Zc:forScope")
> ENDIF(WIN32)
>
> Unfortunately this doesn't work. I was wondering if anyone knows the
> correct way of doing it.

VTK_REQUIRED_CXX_FLAGS is just a variable defined by VTK.  The flags it
lists are later added to the build like this:

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VTK_REQUIRED_CXX_FLAGS}")

You can do

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:forScope")

once you have detected that the intel compiler is being used.  Detecting
this will probably require a TRY_COMPILE with a little .c file that checks
for the #define below.

> And I was also wondering where I can look up the #define of Intel
> compiler in the src? Thank you for your help!

The intel compiler defines "__ICL" in C and C++ code.

-Brad