[cmake-developers] Knowing if a C project is being built (Was Re: [CMake 0012959]: GenerateExportHeaders does not work for C)
Stephen Kelly
steveire at gmail.com
Tue Feb 21 17:47:37 EST 2012
Mantis Bug Tracker wrote:
> ======================================================================
> Summary: GenerateExportHeaders does not work for C
> Description:
> The module GenerateExportHeader creates some defines that may works for C
> too, but actually the module is only intented for C++.
>
> All attributes may be used for C too, that means you can't use
> project(name C).
>
>
> Steps to Reproduce:
> This example will not works:
>
> project(mylib C)
> include(GenerateExportHeader)
>
> add_compiler_export_flags()
> add_library(mylib mylib.c)
> generate_export_header(mylib)
Hi,
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()
?
Thanks,
Steve.
More information about the cmake-developers
mailing list