[CMake] problem passing compiler flags to TRY_COMPILE

David Somers dsomers at omz13.com
Tue Jul 25 11:06:01 EDT 2006


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
	)

But when the test code is executed the flag I've specified 
(-fvisibility=hidden) isn't passed to the compiler. I suspect that I'm doing 
something wrong, but I can't see it myself :-(

Any help/ideas appreciated.

-- 
David Somers
typographer/programmer/whatever


More information about the CMake mailing list