[CMake] problem passing compiler flags to TRY_COMPILE
David Somers
dsomers at omz13.com
Tue Jul 25 11:15:12 EDT 2006
On Tuesday 25 July 2006 17:06, David Somers wrote:
> I'm trying to write a test to check if a gcc compiler options is supported.
>
> I can't quite work out how to get the test code to compile with the flag I
> need check. I've tried doing this:
>
> TRY_COMPILE(CMAKE_GCC_VISIBILITY
> ${CMAKE_BINARY_DIR}
> ${CMAKE_BINARY_DIR}/CMakeTmp/testGCCvisibility.c
> CMAKE_FLAGS -DCMAKE_C_FLAGS:STRING=-fvisibility=hidden
> OUTPUT_VARIABLE OUTPUT
> )
Dammit... just realized I need to do it like:
TRY_COMPILE(CMAKE_GCC_VISIBILITY
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/CMakeTmp/testGCCvisibility.c
COMPILE_DEFINITIONS -visibility=hidden
OUTPUT_VARIABLE OUTPUT
)
COMPILE_DEFINITIONS really should be called COMPILE_FLAGS, imho.
--
David Somers
typographer/programmer/whatever
More information about the CMake
mailing list