ENH: separate the ar program for cxx and c

This commit is contained in:
Bill Hoffman 2002-04-04 11:01:41 -05:00
parent 5d850d2a56
commit 04d53a3865
4 changed files with 33 additions and 23 deletions

View File

@ -692,7 +692,15 @@ void cmUnixMakefileGenerator::OutputStaticLibraryRule(std::ostream& fout,
target = this->ConvertToOutputPath(target.c_str()); target = this->ConvertToOutputPath(target.c_str());
std::string depend = "$("; std::string depend = "$(";
depend += this->CreateMakeVariable(name, "_SRC_OBJS") + ")"; depend += this->CreateMakeVariable(name, "_SRC_OBJS") + ")";
std::string command = "$(CMAKE_AR) $(CMAKE_AR_ARGS) "; std::string command;
if(t.HasCxx())
{
command = "$(CMAKE_CXX_AR) $(CMAKE_CXX_AR_ARGS) ";
}
else
{
command = "$(CMAKE_AR) $(CMAKE_AR_ARGS) ";
}
command += target; command += target;
command += " $("; command += " $(";
command += this->CreateMakeVariable(name, "_SRC_OBJS") + ")"; command += this->CreateMakeVariable(name, "_SRC_OBJS") + ")";
@ -1499,6 +1507,8 @@ void cmUnixMakefileGenerator::OutputMakeVariables(std::ostream& fout)
"CMAKE_RANLIB = @CMAKE_RANLIB@\n" "CMAKE_RANLIB = @CMAKE_RANLIB@\n"
"CMAKE_AR = @CMAKE_AR@\n" "CMAKE_AR = @CMAKE_AR@\n"
"CMAKE_AR_ARGS = @CMAKE_AR_ARGS@\n" "CMAKE_AR_ARGS = @CMAKE_AR_ARGS@\n"
"CMAKE_CXX_AR = @CMAKE_CXX_AR@\n"
"CMAKE_CXX_AR_ARGS = @CMAKE_CXX_AR_ARGS@\n"
"CMAKE_C_COMPILER = @CMAKE_C_COMPILER@\n" "CMAKE_C_COMPILER = @CMAKE_C_COMPILER@\n"
"CMAKE_C_FLAGS = @CMAKE_C_FLAGS@\n" "CMAKE_C_FLAGS = @CMAKE_C_FLAGS@\n"
"CMAKE_SHLIB_CFLAGS = @CMAKE_SHLIB_CFLAGS@\n" "CMAKE_SHLIB_CFLAGS = @CMAKE_SHLIB_CFLAGS@\n"

View File

@ -2,11 +2,11 @@
# CMakeLocal.make.in should be in the directory where you run configure # CMakeLocal.make.in should be in the directory where you run configure
# in, which need not be the source directory # in, which need not be the source directory
# #
SET (CMAKE_AR "@CMAKE_AR@" CACHE FILEPATH SET (CMAKE_CXX_AR "@CMAKE_CXX_AR@" CACHE FILEPATH
"Archive program used to make archive libraries.") "Archive program used to make archive libraries of c++ object files.")
SET (CMAKE_AR_ARGS "@CMAKE_AR_ARGS@" CACHE STRING SET (CMAKE_CXX_AR_ARGS "@CMAKE_CXX_AR_ARGS@" CACHE STRING
"Arguments for CMAKE_AR program to create an archive library.") "Arguments for CMAKE_CXX_AR program to create an archive library.")
SET (CMAKE_CXX_COMPILER "@CXX@" CACHE FILEPATH SET (CMAKE_CXX_COMPILER "@CXX@" CACHE FILEPATH
"Name of C++ compiler used.") "Name of C++ compiler used.")
@ -39,8 +39,8 @@ SET (CMAKE_NO_EXPLICIT_TEMPLATE_INSTANTIATION @CMAKE_NO_EXPLICIT_TEMPLATE_
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
CMAKE_CXX_COMPILER CMAKE_CXX_COMPILER
CMAKE_AR CMAKE_CXX_AR
CMAKE_AR_ARGS CMAKE_CXX_AR_ARGS
CMAKE_TEMPLATE_FLAGS CMAKE_TEMPLATE_FLAGS
CMAKE_NO_ANSI_STREAM_HEADERS CMAKE_NO_ANSI_STREAM_HEADERS
CMAKE_NO_ANSI_FOR_SCOPE CMAKE_NO_ANSI_FOR_SCOPE

View File

@ -855,8 +855,8 @@ fi
test -n "$CMAKE_AR_TMP" && break test -n "$CMAKE_AR_TMP" && break
done done
CMAKE_AR="$CMAKE_AR_TMP" CMAKE_CXX_AR="$CMAKE_AR_TMP"
CMAKE_AR_ARGS="cr" CMAKE_CXX_AR_ARGS="cr"
# if on SunOS and not using gXX then use the compiler to make .a libs # if on SunOS and not using gXX then use the compiler to make .a libs
case $system in case $system in
SunOS-5*) SunOS-5*)
@ -864,8 +864,8 @@ case $system in
: :
else else
echo "Using $CXX -xar -o for creating .a libraries" echo "Using $CXX -xar -o for creating .a libraries"
CMAKE_AR="$CXX" CMAKE_CXX_AR="$CXX"
CMAKE_AR_ARGS="-xar -o" CMAKE_CXX_AR_ARGS="-xar -o"
fi fi
;; ;;
IRIX*) IRIX*)
@ -873,8 +873,8 @@ case $system in
: :
else else
echo "Using $CXX -xar -o for creating .a libraries" echo "Using $CXX -xar -o for creating .a libraries"
CMAKE_AR="$CXX" CMAKE_CXX_AR="$CXX"
CMAKE_AR_ARGS="-ar -o" CMAKE_CXX_AR_ARGS="-ar -o"
fi fi
;; ;;
esac esac
@ -1042,8 +1042,8 @@ s%@CMAKE_NO_ANSI_STREAM_HEADERS@%$CMAKE_NO_ANSI_STREAM_HEADERS%g
s%@CMAKE_NO_STD_NAMESPACE@%$CMAKE_NO_STD_NAMESPACE%g s%@CMAKE_NO_STD_NAMESPACE@%$CMAKE_NO_STD_NAMESPACE%g
s%@CMAKE_NO_ANSI_FOR_SCOPE@%$CMAKE_NO_ANSI_FOR_SCOPE%g s%@CMAKE_NO_ANSI_FOR_SCOPE@%$CMAKE_NO_ANSI_FOR_SCOPE%g
s%@CMAKE_AR_TMP@%$CMAKE_AR_TMP%g s%@CMAKE_AR_TMP@%$CMAKE_AR_TMP%g
s%@CMAKE_AR@%$CMAKE_AR%g s%@CMAKE_CXX_AR@%$CMAKE_CXX_AR%g
s%@CMAKE_AR_ARGS@%$CMAKE_AR_ARGS%g s%@CMAKE_CXX_AR_ARGS@%$CMAKE_CXX_AR_ARGS%g
s%@CMAKE_COMPILER_IS_GNUCXX@%$CMAKE_COMPILER_IS_GNUCXX%g s%@CMAKE_COMPILER_IS_GNUCXX@%$CMAKE_COMPILER_IS_GNUCXX%g
CEOF CEOF

View File

@ -149,8 +149,8 @@ AC_SUBST(CMAKE_NO_ANSI_FOR_SCOPE)
# find make to use to build cmake, prefer gmake # find make to use to build cmake, prefer gmake
AC_PATH_PROGS(CMAKE_AR_TMP, ar) AC_PATH_PROGS(CMAKE_AR_TMP, ar)
CMAKE_AR="$CMAKE_AR_TMP" CMAKE_CXX_AR="$CMAKE_AR_TMP"
CMAKE_AR_ARGS="cr" CMAKE_CXX_AR_ARGS="cr"
# if on SunOS and not using gXX then use the compiler to make .a libs # if on SunOS and not using gXX then use the compiler to make .a libs
case $system in case $system in
SunOS-5*) SunOS-5*)
@ -158,8 +158,8 @@ case $system in
: :
else else
echo "Using $CXX -xar -o for creating .a libraries" echo "Using $CXX -xar -o for creating .a libraries"
CMAKE_AR="$CXX" CMAKE_CXX_AR="$CXX"
CMAKE_AR_ARGS="-xar -o" CMAKE_CXX_AR_ARGS="-xar -o"
fi fi
;; ;;
IRIX*) IRIX*)
@ -167,13 +167,13 @@ case $system in
: :
else else
echo "Using $CXX -xar -o for creating .a libraries" echo "Using $CXX -xar -o for creating .a libraries"
CMAKE_AR="$CXX" CMAKE_CXX_AR="$CXX"
CMAKE_AR_ARGS="-ar -o" CMAKE_CXX_AR_ARGS="-ar -o"
fi fi
;; ;;
esac esac
AC_SUBST(CMAKE_AR) AC_SUBST(CMAKE_CXX_AR)
AC_SUBST(CMAKE_AR_ARGS) AC_SUBST(CMAKE_CXX_AR_ARGS)
CMAKE_COMPILER_IS_GNUGXX=0 CMAKE_COMPILER_IS_GNUGXX=0
if test $ac_cv_prog_gxx = yes; then if test $ac_cv_prog_gxx = yes; then