export(): Document undefined behavior of location properties

Since the export() command needs to know the final location of a target
in the build tree we cannot allow properties affecting the location or
name of a target file to be set after the target is passed to export().

Fix a violation of this rule in the SimpleInstall test.
This commit is contained in:
Brad King 2011-12-01 15:41:19 -05:00
parent 363d3962c4
commit fea3e84ee3
3 changed files with 14 additions and 10 deletions

View File

@ -13,6 +13,7 @@
#define cmExportCommand_h #define cmExportCommand_h
#include "cmCommand.h" #include "cmCommand.h"
#include "cmDocumentLocationUndefined.h"
class cmExportBuildFileGenerator; class cmExportBuildFileGenerator;
@ -80,6 +81,7 @@ public:
"should never be installed. " "should never be installed. "
"See the install(EXPORT) command to export targets from an " "See the install(EXPORT) command to export targets from an "
"installation tree." "installation tree."
CM_LOCATION_UNDEFINED_BEHAVIOR("passing it to this command")
"\n" "\n"
" export(PACKAGE <name>)\n" " export(PACKAGE <name>)\n"
"Store the current build directory in the CMake user package registry " "Store the current build directory in the CMake user package registry "

View File

@ -173,6 +173,12 @@ ELSE(STAGE2)
TARGET_LINK_LIBRARIES(SimpleInstall test1 test2 test4) TARGET_LINK_LIBRARIES(SimpleInstall test1 test2 test4)
SET(install_target SimpleInstall) SET(install_target SimpleInstall)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe)
# Disable VERSION test until it is implemented in the Xcode generator.
IF(NOT XCODE)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2)
ENDIF(NOT XCODE)
# Make sure the test executable can run from the install tree. # Make sure the test executable can run from the install tree.
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib) INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
@ -293,11 +299,6 @@ ELSE(STAGE2)
ADDITIONAL_MAKE_CLEAN_FILES ADDITIONAL_MAKE_CLEAN_FILES
"${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake") "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake")
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe)
# Disable VERSION test until it is implemented in the Xcode generator.
IF(NOT XCODE)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2)
ENDIF(NOT XCODE)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT
${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake) ${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT

View File

@ -173,6 +173,12 @@ ELSE(STAGE2)
TARGET_LINK_LIBRARIES(SimpleInstall test1 test2 test4) TARGET_LINK_LIBRARIES(SimpleInstall test1 test2 test4)
SET(install_target SimpleInstall) SET(install_target SimpleInstall)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe)
# Disable VERSION test until it is implemented in the Xcode generator.
IF(NOT XCODE)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2)
ENDIF(NOT XCODE)
# Make sure the test executable can run from the install tree. # Make sure the test executable can run from the install tree.
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib) INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/MyTest/lib)
@ -293,11 +299,6 @@ ELSE(STAGE2)
ADDITIONAL_MAKE_CLEAN_FILES ADDITIONAL_MAKE_CLEAN_FILES
"${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake") "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake")
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe)
# Disable VERSION test until it is implemented in the Xcode generator.
IF(NOT XCODE)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2)
ENDIF(NOT XCODE)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES PRE_INSTALL_SCRIPT
${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake) ${CMAKE_CURRENT_SOURCE_DIR}/PreInstall.cmake)
SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES POST_INSTALL_SCRIPT