ENH: Better handling of debug postfix and fix the test

This commit is contained in:
Andy Cedilnik 2004-06-29 09:23:27 -04:00
parent ed0999c9d1
commit 43d380e0d8
3 changed files with 22 additions and 50 deletions

View File

@ -249,6 +249,15 @@ bool cmFileCommand::HandleInstallCommand(
std::string destination = "";
std::string stype = "FILES";
const char* build_type = m_Makefile->GetDefinition("BUILD_TYPE");
if ( build_type && strcmp(build_type, ".") == 0 )
{
build_type = 0;
}
if ( build_type && strncmp(build_type, ".\\", 2) == 0 )
{
build_type += 2;
}
const char* debug_postfix
= m_Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX");
const char* destdir = cmSystemTools::GetEnv("DESTDIR");
@ -259,7 +268,7 @@ bool cmFileCommand::HandleInstallCommand(
{
extra_dir = build_type;
std::string btype = cmSystemTools::LowerCase(build_type);
if ( btype == "debug" )
if ( strncmp(btype.c_str(), "debug", strlen("debug")) == 0 )
{
debug = 1;
}
@ -441,13 +450,19 @@ bool cmFileCommand::HandleInstallCommand(
for ( i = 0; i < files.size(); i ++ )
{
std::string destfile
= destination + "/" + cmSystemTools::GetFilenameName(files[i]);
std::string destfilewe
= destination + "/"
+ cmSystemTools::GetFilenameWithoutExtension(files[i]);
std::string ctarget = files[i].c_str();
std::string fname = cmSystemTools::GetFilenameName(ctarget);
std::string ext = cmSystemTools::GetFilenameExtension(ctarget);
std::string fnamewe
= cmSystemTools::GetFilenameWithoutExtension(ctarget);
std::string destfile = destfilewe;
if ( ext.size() )
{
destfile + "." + ext;
}
switch( itype )
{
case cmTarget::MODULE_LIBRARY:
@ -456,6 +471,7 @@ bool cmFileCommand::HandleInstallCommand(
if ( debug )
{
fname = fnamewe + debug_postfix + ext;
destfile = destfilewe + debug_postfix + ext;
}
{
// Handle shared library versioning
@ -564,7 +580,7 @@ bool cmFileCommand::HandleInstallCommand(
) )
{
cmOStringStream err;
err << "Program setting permissions on file: " << destfile.c_str();
err << "Problem setting permissions on file: " << destfile.c_str();
perror(err.str().c_str());
}
}

View File

@ -7,28 +7,6 @@ SET(LIBRARY_OUTPUT_PATH "${EXECUTABLE_OUTPUT_PATH}")
SET(CMAKE_DEBUG_POSTFIX "_test_debug_postfix")
SET(EXTRA_INSTALL_FLAGS)
IF(CMAKE_GENERATOR MATCHES "^Visual Studio")
MESSAGE("CMake generator: ${CMAKE_GENERATOR}")
FOREACH(build_type Debug Release RelWithDebInfo MinSizeRel)
IF(MAKEPROGRAM MATCHES "/build ${build_type}")
SET(EXTRA_INSTALL_FLAGS -DBUILD_TYPE=${build_type})
ENDIF(MAKEPROGRAM MATCHES "/build ${build_type}")
IF(MAKEPROGRAM MATCHES "- ${build_type}")
SET(EXTRA_INSTALL_FLAGS -DBUILD_TYPE=${build_type})
ENDIF(MAKEPROGRAM MATCHES "- ${build_type}")
ENDFOREACH(build_type)
IF(NOT ${EXTRA_INSTALL_FLAGS})
IF(BUILD_TYPE)
SET(EXTRA_INSTALL_FLAGS -DBUILD_TYPE=${BUILD_TYPE})
ENDIF(BUILD_TYPE)
ENDIF(NOT ${EXTRA_INSTALL_FLAGS})
IF(NOT DEFINED EXTRA_INSTALL_FLAGS)
IF(NOT "$ENV{SIMPLE_INSTALL_BUILD_TYPE}" MATCHES "^$")
SET(EXTRA_INSTALL_FLAGS -DBUILD_TYPE=$ENV{SIMPLE_INSTALL_BUILD_TYPE})
ENDIF(NOT "$ENV{SIMPLE_INSTALL_BUILD_TYPE}" MATCHES "^$")
ENDIF(NOT DEFINED EXTRA_INSTALL_FLAGS)
ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio")
MESSAGE("Extra install: ${EXTRA_INSTALL_FLAGS}")
IF(STAGE2)
@ -94,7 +72,7 @@ ADD_CUSTOM_COMMAND(
TARGET ${install_target}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS ${EXTRA_INSTALL_FLAGS}
ARGS -DBUILD_TYPE:STRING=${CMAKE_CFG_INTDIR}
-P "${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake"
COMMENT "Install Project"
)

View File

@ -7,28 +7,6 @@ SET(LIBRARY_OUTPUT_PATH "${EXECUTABLE_OUTPUT_PATH}")
SET(CMAKE_DEBUG_POSTFIX "_test_debug_postfix")
SET(EXTRA_INSTALL_FLAGS)
IF(CMAKE_GENERATOR MATCHES "^Visual Studio")
MESSAGE("CMake generator: ${CMAKE_GENERATOR}")
FOREACH(build_type Debug Release RelWithDebInfo MinSizeRel)
IF(MAKEPROGRAM MATCHES "/build ${build_type}")
SET(EXTRA_INSTALL_FLAGS -DBUILD_TYPE=${build_type})
ENDIF(MAKEPROGRAM MATCHES "/build ${build_type}")
IF(MAKEPROGRAM MATCHES "- ${build_type}")
SET(EXTRA_INSTALL_FLAGS -DBUILD_TYPE=${build_type})
ENDIF(MAKEPROGRAM MATCHES "- ${build_type}")
ENDFOREACH(build_type)
IF(NOT ${EXTRA_INSTALL_FLAGS})
IF(BUILD_TYPE)
SET(EXTRA_INSTALL_FLAGS -DBUILD_TYPE=${BUILD_TYPE})
ENDIF(BUILD_TYPE)
ENDIF(NOT ${EXTRA_INSTALL_FLAGS})
IF(NOT DEFINED EXTRA_INSTALL_FLAGS)
IF(NOT "$ENV{SIMPLE_INSTALL_BUILD_TYPE}" MATCHES "^$")
SET(EXTRA_INSTALL_FLAGS -DBUILD_TYPE=$ENV{SIMPLE_INSTALL_BUILD_TYPE})
ENDIF(NOT "$ENV{SIMPLE_INSTALL_BUILD_TYPE}" MATCHES "^$")
ENDIF(NOT DEFINED EXTRA_INSTALL_FLAGS)
ENDIF(CMAKE_GENERATOR MATCHES "^Visual Studio")
MESSAGE("Extra install: ${EXTRA_INSTALL_FLAGS}")
IF(STAGE2)
@ -94,7 +72,7 @@ ADD_CUSTOM_COMMAND(
TARGET ${install_target}
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS ${EXTRA_INSTALL_FLAGS}
ARGS -DBUILD_TYPE:STRING=${CMAKE_CFG_INTDIR}
-P "${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake"
COMMENT "Install Project"
)