[Insight-developers] CMake TRY_COMPILE help

Hans Johnson hjohnson at psychiatry.uiowa.edu
Fri Jul 2 15:40:28 EDT 2004


Hello All,

I've just submitted a modification to the main CMakeList.txt file for
ITK.  I was hoping that this would make the build smarter for when to
include/exclude the -i_dynamic flag under the intel compiler.

IF(UNIX)
  TRY_COMPILE(INTEL_COMPILER_NO_I_DYNAMIC ${ITK_BINARY_DIR}
${ITK_SOURCE_DIR}/CMake/test_intel_requires_i_dynamic.cxx )
  IF(INTEL_COMPILER_NO_I_DYNAMIC)
    SET(ITK_REQUIRED_CXX_FLAGS "${ITK_REQUIRED_CXX_FLAGS}")
  ELSE(INTEL_COMPILER_NO_I_DYNAMIC)
    SET(ITK_REQUIRED_CXX_FLAGS "${ITK_REQUIRED_CXX_FLAGS} -i_dynamic")
  ENDIF(INTEL_COMPILER_NO_I_DYNAMIC)
ENDIF(UNIX)

On Intel 8 INTEL_COMPILER_NO_I_DYNAMIC should be TRUE and -i_dynamic is
not needed

On Intel 7 (+RH9, EL-3, SUSE 9 ...) INTEL_COMPILER_NO_I_DYNAMIC should
be FALSE and -i_dynamic is needed as a work around

Looking at the CMakeCache.txt file shows that the TRY_COMPILE is
actually setting the INTEL_COMPILER_NO_I_DYNAMIC variable correctly ,
but neither the IF or the ELSE part of this logic is is ever occuring.


As a test I used the following code:


> IF(UNIX)
>   TRY_COMPILE(INTEL_COMPILER_NO_I_DYNAMIC ${ITK_BINARY_DIR}
> ${ITK_SOURCE_DIR}/CMake/test_intel_requires_i_dynamic.cxx )
>   IF(INTEL_COMPILER_NO_I_DYNAMIC)
>     SET(ITK_REQUIRED_CXX_FLAGS "${ITK_REQUIRED_CXX_FLAGS} 
> -FLAG_IS_TRUE_ERROR")
>   ELSE(INTEL_COMPILER_NO_I_DYNAMIC)
>     SET(ITK_REQUIRED_CXX_FLAGS "${ITK_REQUIRED_CXX_FLAGS}
> -FLAG_IS_FALSE_ERROR")
>   ENDIF(INTEL_COMPILER_NO_I_DYNAMIC)
> ENDIF(UNIX)

and neither of the flags was added.

I am using CMake v 1.8.3

Regards,
Hans




More information about the Insight-developers mailing list