Commit f4284ba6 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Fix BUILD/compile-pentium64-xxx scripts, when ccache is present.

Fix contains of :
-  splitting CC/CXX if there are more that 2 space-delimited tokens, add the rest to CFLAGS
(in this case CC was set to "ccache gcc --pipe", and this broke recognition of gcc compiler
as CMake understands CC consisting of 2 space delimited tokens but not more)

-  add my_new.cc to mysys fle list if C++ operator new is not found. Always, not only
for gcc  (the original problem was that missing operator new when compiling with CXX=gcc)
parent e605213c
...@@ -38,6 +38,38 @@ sub set_installdir ...@@ -38,6 +38,38 @@ sub set_installdir
} }
} }
# CMake understands CC and CXX env.variables correctly, if they contain 1 or 2 tokens
# e.g CXX=gcc and CXX="ccache gcc" are ok. However it could have a problem if there
# (recognizing gcc) with more tokens ,e.g CXX="ccache gcc --pipe".
# The problem is simply fixed by splitting compiler and flags, e.g
# CXX="ccache gcc --pipe" => CXX=ccache gcc CXXFLAGS=--pipe
sub check_compiler
{
my ($varname, $flagsvarname) = @_;
my @tokens = split(/ /,$ENV{$varname});
if($#tokens >= 2)
{
$ENV{$varname} = $tokens[0]." ".$tokens[1];
my $flags;
for(my $i=2; $i<=$#tokens; $i++)
{
$flags= $flags." ".$tokens[$i];
}
if(defined $ENV{$flagsvarname})
{
$flags = $flags." ".$ENV{$flagsvarname};
}
$ENV{$flagsvarname}=$flags;
print("$varname=$ENV{$varname}\n");
print("$flagsvarname=$ENV{$flagsvarname}\n");
}
}
check_compiler("CC", "CFLAGS");
check_compiler("CXX", "CXXFLAGS");
foreach my $option (@ARGV) foreach my $option (@ARGV)
{ {
if (substr ($option, 0, 2) == "--") if (substr ($option, 0, 2) == "--")
......
...@@ -42,7 +42,7 @@ IF (WIN32) ...@@ -42,7 +42,7 @@ IF (WIN32)
SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_winthread.c my_wincond.c my_winerr.c my_winfile.c my_windac.c my_conio.c) SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_winthread.c my_wincond.c my_winerr.c my_winfile.c my_windac.c my_conio.c)
ENDIF() ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC AND NOT HAVE_CXX_NEW) IF(NOT HAVE_CXX_NEW)
# gcc as C++ compiler does not have new/delete # gcc as C++ compiler does not have new/delete
SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_new.cc) SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_new.cc)
ADD_DEFINITIONS( -DUSE_MYSYS_NEW) ADD_DEFINITIONS( -DUSE_MYSYS_NEW)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment