On 2/21/2012 5:47 PM, Stephen Kelly wrote:
>> add_library(mylib mylib.c)
>> generate_export_header(mylib)
>
> I'm looking into fixing this bug, and I was wondering how to. I have never 
> built C code with CMake. 
> 
> I will need to conditionally call different check_compiles macros. Can I so 
> something like
> 
> if(CMAKE_C_PROJECT)
> check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
> else()
> check_c_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
> endif()

Use CMAKE_<LANG>_COMPILER_LOADED to determine which
languages are enabled.  Then check both C and CXX
compilers.  If the results are the same then you
can just write the header normally.  Otherwise write
the header with #ifdef __cplusplus to distinguish
the two compilers.

-Brad
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to