The following issue has been SUBMITTED. 
====================================================================== 
https://cmake.org/Bug/view.php?id=15829 
====================================================================== 
Reported By:                Julien Bigot
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15829
Category:                   Modules
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-11-03 12:12 CET
Last Modified:              2015-11-03 12:12 CET
====================================================================== 
Summary:                    GenerateExportHeaders does not work for C
Description: 
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

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)


[...]
-- 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)
[...]
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-11-03 12:12 Julien Bigot   New Issue                                    
======================================================================

-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

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

Reply via email to