summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-06-29 13:23:27 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-06-29 13:23:27 (GMT)
commit43d380e0d8c6458b7b729dbc8eab4f504960f9f9 (patch)
treee8378ac0343ed8aa6958059257d2832f1033d2bc
parented0999c9d1c60bdb5be4354e068a95936819b996 (diff)
downloadCMake-43d380e0d8c6458b7b729dbc8eab4f504960f9f9.zip
CMake-43d380e0d8c6458b7b729dbc8eab4f504960f9f9.tar.gz
CMake-43d380e0d8c6458b7b729dbc8eab4f504960f9f9.tar.bz2
ENH: Better handling of debug postfix and fix the test
-rw-r--r--Source/cmFileCommand.cxx24
-rw-r--r--Tests/SimpleInstall/CMakeLists.txt24
-rw-r--r--Tests/SimpleInstallS2/CMakeLists.txt24
3 files changed, 22 insertions, 50 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index c178059..3a22e21 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -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());
}
}
diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt
index 22f8387..e1e08b1 100644
--- a/Tests/SimpleInstall/CMakeLists.txt
+++ b/Tests/SimpleInstall/CMakeLists.txt
@@ -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"
)
diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt
index 22f8387..e1e08b1 100644
--- a/Tests/SimpleInstallS2/CMakeLists.txt
+++ b/Tests/SimpleInstallS2/CMakeLists.txt
@@ -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"
)