Closed smanders closed 2 years ago
I can confirm that our current build of lua, which is built via cmake (not the Makefiles in the repo), builds with the C compiler, not the C++ compiler
-- The C compiler identification is GNU 7.3.1
-- Check for working C compiler: /opt/rh/devtoolset-7/root/usr/bin/cc
-- Check for working C compiler: /opt/rh/devtoolset-7/root/usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test has_c_fPIC
-- Performing Test has_c_fPIC - Success
-- Performing Test has_c_msse3
-- Performing Test has_c_msse3 - Success
-- Performing Test has_c_StrongSP
-- Performing Test has_c_StrongSP - Success
DIST_NAME: lua
DIST_VERSION: 5.2.3
DIST_LICENSE: MIT/X11
DIST_AUTHOR: Roberto Ierusalimschy, Waldemar Celes, Luiz Henrique de Figueiredo
DIST_MAINTAINER: Peter Drahoš
DIST_URL: http://www.lua.org
DIST_DESC: Lua is a powerful, fast, light-weight, embeddable scripting language.
DIST_DEPENDS:
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.27.1")
-- Could NOT find Readline (missing: READLINE_LIBRARY READLINE_INCLUDE_DIR)
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
-- Configuring done
-- Generating done
-- Build files have been written to: /srcdir/externpro/_bldlua/xpbase/Build/lua_Release
[ 62%] Performing build step for 'lua_Release'
Scanning dependencies of target liblua
[ 1%] Building C object CMakeFiles/liblua.dir/src/lapi.c.o
[ 2%] Building C object CMakeFiles/liblua.dir/src/lcode.c.o
[ 4%] Building C object CMakeFiles/liblua.dir/src/lctype.c.o
[ 5%] Building C object CMakeFiles/liblua.dir/src/ldebug.c.o
notice that only the C compiler is detected at the beginning of the cmake run, and "Building C object" as the source is compiled
replacing C
with CXX
exposes cmake errors in externpro, and adding CXX
isn't enough
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 12f1aae..6877fbd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,7 @@
# For details see the COPYRIGHT file distributed with LuaDist.
# Please note that the package source code is licensed under its own license.
-project ( lua C )
+project ( lua C CXX )
cmake_minimum_required ( VERSION 2.8 )
include ( flags OPTIONAL )
include ( cmake/dist.cmake )
-- The C compiler identification is GNU 7.3.1
-- The CXX compiler identification is GNU 7.3.1
-- Check for working C compiler: /opt/rh/devtoolset-7/root/usr/bin/cc
-- Check for working C compiler: /opt/rh/devtoolset-7/root/usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /opt/rh/devtoolset-7/root/usr/bin/c++
-- Check for working CXX compiler: /opt/rh/devtoolset-7/root/usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test has_c_fPIC
-- Performing Test has_c_fPIC - Success
-- Performing Test has_c_msse3
-- Performing Test has_c_msse3 - Success
-- Performing Test has_c_StrongSP
-- Performing Test has_c_StrongSP - Success
-- Performing Test has_cxx_fPIC
-- Performing Test has_cxx_fPIC - Success
-- Performing Test has_cxx_msse3
-- Performing Test has_cxx_msse3 - Success
-- Performing Test has_cxx_StrongSP
-- Performing Test has_cxx_StrongSP - Success
DIST_NAME: lua
DIST_VERSION: 5.2.3
DIST_LICENSE: MIT/X11
DIST_AUTHOR: Roberto Ierusalimschy, Waldemar Celes, Luiz Henrique de Figueiredo
DIST_MAINTAINER: Peter Drahoš
DIST_URL: http://www.lua.org
DIST_DESC: Lua is a powerful, fast, light-weight, embeddable scripting language.
DIST_DEPENDS:
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.27.1")
-- Could NOT find Readline (missing: READLINE_LIBRARY READLINE_INCLUDE_DIR)
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
-- Configuring done
-- Generating done
-- Build files have been written to: /srcdir/externpro/_bldlua/xpbase/Build/lua_Release
[ 62%] Performing build step for 'lua_Release'
Scanning dependencies of target liblua
[ 1%] Building C object CMakeFiles/liblua.dir/src/lapi.c.o
[ 2%] Building C object CMakeFiles/liblua.dir/src/lcode.c.o
[ 4%] Building C object CMakeFiles/liblua.dir/src/lctype.c.o
[ 5%] Building C object CMakeFiles/liblua.dir/src/ldebug.c.o
the C++ compiler is also detected at the beginning of the cmake run, but still "Building C object" as the source is compiled
however, if I add a make rules override file (and also put the cmake_minimum_required()
call first, as it's supposed to be)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 12f1aae..503b048 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,8 +4,9 @@
# For details see the COPYRIGHT file distributed with LuaDist.
# Please note that the package source code is licensed under its own license.
-project ( lua C )
cmake_minimum_required ( VERSION 2.8 )
+set ( CMAKE_USER_MAKE_RULES_OVERRIDE cmake/makeRulesOverwrite.cmake )
+project ( lua C CXX )
include ( flags OPTIONAL )
include ( cmake/dist.cmake )
diff --git a/cmake/makeRulesOverwrite.cmake b/cmake/makeRulesOverwrite.cmake
new file mode 100644
index 0000000..e1d6095
--- /dev/null
+++ b/cmake/makeRulesOverwrite.cmake
@@ -0,0 +1 @@
+list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS c)
-- The C compiler identification is GNU 7.3.1
-- The CXX compiler identification is GNU 7.3.1
-- Check for working C compiler: /opt/rh/devtoolset-7/root/usr/bin/cc
-- Check for working C compiler: /opt/rh/devtoolset-7/root/usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /opt/rh/devtoolset-7/root/usr/bin/c++
-- Check for working CXX compiler: /opt/rh/devtoolset-7/root/usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test has_c_fPIC
-- Performing Test has_c_fPIC - Success
-- Performing Test has_c_msse3
-- Performing Test has_c_msse3 - Success
-- Performing Test has_c_StrongSP
-- Performing Test has_c_StrongSP - Success
-- Performing Test has_cxx_fPIC
-- Performing Test has_cxx_fPIC - Success
-- Performing Test has_cxx_msse3
-- Performing Test has_cxx_msse3 - Success
-- Performing Test has_cxx_StrongSP
-- Performing Test has_cxx_StrongSP - Success
DIST_NAME: lua
DIST_VERSION: 5.2.3
DIST_LICENSE: MIT/X11
DIST_AUTHOR: Roberto Ierusalimschy, Waldemar Celes, Luiz Henrique de Figueiredo
DIST_MAINTAINER: Peter Drahoš
DIST_URL: http://www.lua.org
DIST_DESC: Lua is a powerful, fast, light-weight, embeddable scripting language.
DIST_DEPENDS:
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.27.1")
-- Could NOT find Readline (missing: READLINE_LIBRARY READLINE_INCLUDE_DIR)
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
-- Configuring done
-- Generating done
-- Build files have been written to: /srcdir/externpro/_bldlua/xpbase/Build/lua_Release
[ 62%] Performing build step for 'lua_Release'
Scanning dependencies of target liblua
[ 1%] Building CXX object CMakeFiles/liblua.dir/src/lapi.c.o
[ 2%] Building CXX object CMakeFiles/liblua.dir/src/lcode.c.o
[ 4%] Building CXX object CMakeFiles/liblua.dir/src/lctype.c.o
[ 5%] Building CXX object CMakeFiles/liblua.dir/src/ldebug.c.o
notice: "Building CXX object" as the source is compiled
I've tested that this also builds successfully on Windows, but I don't have any visual indication on Windows that it's using the C++ compiler and not the C compiler
moved to "future", since it appears to be less of an issue to the developers using lua
closing issue, for now... if we ever decide to compile lua with C++ compiler instead of C compiler, this issue has the information on how to do so