CPackIFW: Search algorithm update

Variables like CPACK_IFW_*_EXECUTABLE_FOUND now not needed
This commit is contained in:
Konstantin Podsvirov 2014-10-04 22:55:43 +04:00
parent ab74ad5a5f
commit f9f748745c
2 changed files with 35 additions and 53 deletions

View File

@ -25,6 +25,8 @@
# and Mac OS X. # and Mac OS X.
# #
# To use CPack ``IFW`` generator you must also install QtIFW_. # To use CPack ``IFW`` generator you must also install QtIFW_.
# If you are not using the default path for the installation, please set
# the path to the variable ``QTIFWDIR``.
# #
# Variables # Variables
# ^^^^^^^^^ # ^^^^^^^^^
@ -95,7 +97,7 @@
# Additional prepared packages dirs that will be used to resolve # Additional prepared packages dirs that will be used to resolve
# dependent components. # dependent components.
# #
# Advanced # Tools
# """""""" # """"""""
# #
# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE # .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE
@ -104,20 +106,12 @@
# #
# This variable is cached and can be configured user if need. # This variable is cached and can be configured user if need.
# #
# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND
#
# True if the "binarycreator" command line client was found.
#
# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE # .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE
# #
# The path to "repogen" command line client. # The path to "repogen" command line client.
# #
# This variable is cached and can be configured user if need. # This variable is cached and can be configured user if need.
# #
# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE_FOUND
#
# True if the "repogen" command line client was found.
#
# Commands # Commands
# ^^^^^^^^^ # ^^^^^^^^^
# #
@ -264,48 +258,41 @@
# Default path # Default path
set(_CPACK_IFW_PATHS
"${QTIFWDIR}"
"$ENV{QTIFWDIR}"
"${QTDIR}"
"$ENV{QTIFWDIR}")
if(WIN32) if(WIN32)
set(_CPACK_IFW_PATHS list(APPEND _CPACK_IFW_PATHS
"$ENV{HOMEDRIVE}/Qt" "$ENV{HOMEDRIVE}/Qt"
"C:/Qt" "C:/Qt")
)
else() else()
set(_CPACK_IFW_PATHS list(APPEND _CPACK_IFW_PATHS
"$ENV{HOME}/Qt" "$ENV{HOME}/Qt"
"/opt/Qt" "/opt/Qt")
)
endif() endif()
set(_CPACK_IFW_SUFFIXES set(_CPACK_IFW_SUFFIXES
"QtIFW-1.7.0/bin" "bin"
"QtIFW-1.6.0/bin" "QtIFW-1.7.0/bin"
"QtIFW-1.5.0/bin" "QtIFW-1.6.0/bin"
"QtIFW-1.4.0/bin" "QtIFW-1.5.0/bin"
"QtIFW-1.3.0/bin" "QtIFW-1.4.0/bin"
) "QtIFW-1.3.0/bin")
# Look for 'binarycreator' # Look for 'binarycreator'
if(NOT CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND)
find_program(CPACK_IFW_BINARYCREATOR_EXECUTABLE find_program(CPACK_IFW_BINARYCREATOR_EXECUTABLE
NAMES binarycreator NAMES binarycreator
PATHS ${_CPACK_IFW_PATHS} PATHS ${_CPACK_IFW_PATHS}
PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES} PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
DOC "QtIFW binarycreator command line client" DOC "QtIFW binarycreator command line client")
)
mark_as_advanced(CPACK_IFW_BINARYCREATOR_EXECUTABLE) mark_as_advanced(CPACK_IFW_BINARYCREATOR_EXECUTABLE)
if(EXISTS ${CPACK_IFW_BINARYCREATOR_EXECUTABLE})
set(CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND 1)
endif()
endif() # NOT CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND
# Look for 'repogen' # Look for 'repogen'
if(NOT CPACK_IFW_REPOGEN_EXECUTABLE_FOUND)
find_program(CPACK_IFW_REPOGEN_EXECUTABLE find_program(CPACK_IFW_REPOGEN_EXECUTABLE
NAMES repogen NAMES repogen
PATHS ${_CPACK_IFW_PATHS} PATHS ${_CPACK_IFW_PATHS}
@ -314,12 +301,6 @@ find_program(CPACK_IFW_REPOGEN_EXECUTABLE
) )
mark_as_advanced(CPACK_IFW_REPOGEN_EXECUTABLE) mark_as_advanced(CPACK_IFW_REPOGEN_EXECUTABLE)
if(EXISTS ${CPACK_IFW_REPOGEN_EXECUTABLE})
set(CPACK_IFW_REPOGEN_EXECUTABLE_FOUND 1)
endif()
endif() # NOT CPACK_IFW_REPOGEN_EXECUTABLE_FOUND
# #
## Next code is included only once ## Next code is included only once
# #

View File

@ -223,23 +223,25 @@ int cmCPackIFWGenerator::InitializeInternal()
{ {
// Search Qt Installer Framework tools // Search Qt Installer Framework tools
if(!this->IsOn("CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND") || const std::string BinCreatorOpt = "CPACK_IFW_BINARYCREATOR_EXECUTABLE";
!this->IsOn("CPACK_IFW_REPOGEN_EXECUTABLE_FOUND")) const std::string RepoGenOpt = "CPACK_IFW_REPOGEN_EXECUTABLE";
if(!this->IsSet(BinCreatorOpt) ||
!this->IsSet(RepoGenOpt))
{ {
this->ReadListFile("CPackIFW.cmake"); this->ReadListFile("CPackIFW.cmake");
} }
// Look 'binarycreator' executable (needs) // Look 'binarycreator' executable (needs)
if(this->IsOn("CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND")) const char *BinCreatorStr = this->GetOption(BinCreatorOpt);
if(!BinCreatorStr || cmSystemTools::IsNOTFOUND(BinCreatorStr))
{ {
const char *ifwBinCreatorStr = BinCreator = "";
this->GetOption("CPACK_IFW_BINARYCREATOR_EXECUTABLE");
BinCreator = ifwBinCreatorStr ? ifwBinCreatorStr : "";
} }
else else
{ {
BinCreator = ""; BinCreator = BinCreatorStr;
} }
if (BinCreator.empty()) if (BinCreator.empty())
@ -253,15 +255,14 @@ int cmCPackIFWGenerator::InitializeInternal()
// Look 'repogen' executable (optional) // Look 'repogen' executable (optional)
if(this->IsOn("CPACK_IFW_REPOGEN_EXECUTABLE_FOUND")) const char *RepoGenStr = this->GetOption(RepoGenOpt);
if(!RepoGenStr || cmSystemTools::IsNOTFOUND(RepoGenStr))
{ {
const char *ifwRepoGenStr = RepoGen = "";
this->GetOption("CPACK_IFW_REPOGEN_EXECUTABLE");
RepoGen = ifwRepoGenStr ? ifwRepoGenStr : "";
} }
else else
{ {
RepoGen = ""; RepoGen = RepoGenStr;
} }
// Variables that Change Behavior // Variables that Change Behavior