MantisBT - CMake
View Issue Details
0015829CMakeModulespublic2015-11-03 06:122016-06-10 14:31
Julien Bigot 
Kitware Robot 
normalmajoralways
closedmoved 
Debianunstable
CMake 3.3.2 
 
0015829: GenerateExportHeaders does not work for C
This is a duplicate of issue 0012959 that has been closed as fixed but is not.

The module GenerateExportHeader creates some defines that work for C but it require C++ to be enabled in order to be used. Indeed, the macro check_cxx_compiler_flag is used in many places. That means you can't use project(name C).

A fix for this is proposed in comment 0035809 of issue 0014456
This example will not works:

project(mylib C)
include(GenerateExportHeader)

add_compiler_export_flags()
add_library(mylib mylib.c)
generate_export_header(mylib)


[...]
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
CMake Error at /usr/share/cmake-3.3/Modules/CheckCXXSourceCompiles.cmake:76 (try_compile):
  Unknown extension ".cxx" for file

    /[...]/CMakeFiles/CMakeTmp/src.cxx

  try_compile() works only for enabled languages. Currently these are:

    C

  See project() command to enable other languages.
Call Stack (most recent call first):
  /usr/share/cmake-3.3/Modules/CheckCXXCompilerFlag.cmake:50 (CHECK_CXX_SOURCE_COMPILES)
  /usr/share/cmake-3.3/Modules/GenerateExportHeader.cmake:223 (check_cxx_compiler_flag)
  /usr/share/cmake-3.3/Modules/GenerateExportHeader.cmake:371 (_test_compiler_hidden_visibility)
  CMakeLists.txt:6 (generate_export_header)
[...]
No tags attached.
Issue History
2015-11-03 06:12Julien BigotNew Issue
2016-06-10 14:29Kitware RobotNote Added: 0042878
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042878)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.