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.
#
# 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
# ^^^^^^^^^
@ -95,7 +97,7 @@
# Additional prepared packages dirs that will be used to resolve
# dependent components.
#
# Advanced
# Tools
# """"""""
#
# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE
@ -104,20 +106,12 @@
#
# 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
#
# The path to "repogen" command line client.
#
# 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
# ^^^^^^^^^
#
@ -264,48 +258,41 @@
# Default path
set(_CPACK_IFW_PATHS
"${QTIFWDIR}"
"$ENV{QTIFWDIR}"
"${QTDIR}"
"$ENV{QTIFWDIR}")
if(WIN32)
set(_CPACK_IFW_PATHS
"$ENV{HOMEDRIVE}/Qt"
"C:/Qt"
)
list(APPEND _CPACK_IFW_PATHS
"$ENV{HOMEDRIVE}/Qt"
"C:/Qt")
else()
set(_CPACK_IFW_PATHS
"$ENV{HOME}/Qt"
"/opt/Qt"
)
list(APPEND _CPACK_IFW_PATHS
"$ENV{HOME}/Qt"
"/opt/Qt")
endif()
set(_CPACK_IFW_SUFFIXES
"QtIFW-1.7.0/bin"
"QtIFW-1.6.0/bin"
"QtIFW-1.5.0/bin"
"QtIFW-1.4.0/bin"
"QtIFW-1.3.0/bin"
)
"bin"
"QtIFW-1.7.0/bin"
"QtIFW-1.6.0/bin"
"QtIFW-1.5.0/bin"
"QtIFW-1.4.0/bin"
"QtIFW-1.3.0/bin")
# Look for 'binarycreator'
if(NOT CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND)
find_program(CPACK_IFW_BINARYCREATOR_EXECUTABLE
NAMES binarycreator
PATHS ${_CPACK_IFW_PATHS}
PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
DOC "QtIFW binarycreator command line client"
)
DOC "QtIFW binarycreator command line client")
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'
if(NOT CPACK_IFW_REPOGEN_EXECUTABLE_FOUND)
find_program(CPACK_IFW_REPOGEN_EXECUTABLE
NAMES repogen
PATHS ${_CPACK_IFW_PATHS}
@ -314,12 +301,6 @@ find_program(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
#

View File

@ -223,23 +223,25 @@ int cmCPackIFWGenerator::InitializeInternal()
{
// Search Qt Installer Framework tools
if(!this->IsOn("CPACK_IFW_BINARYCREATOR_EXECUTABLE_FOUND") ||
!this->IsOn("CPACK_IFW_REPOGEN_EXECUTABLE_FOUND"))
const std::string BinCreatorOpt = "CPACK_IFW_BINARYCREATOR_EXECUTABLE";
const std::string RepoGenOpt = "CPACK_IFW_REPOGEN_EXECUTABLE";
if(!this->IsSet(BinCreatorOpt) ||
!this->IsSet(RepoGenOpt))
{
this->ReadListFile("CPackIFW.cmake");
}
// 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 =
this->GetOption("CPACK_IFW_BINARYCREATOR_EXECUTABLE");
BinCreator = ifwBinCreatorStr ? ifwBinCreatorStr : "";
BinCreator = "";
}
else
{
BinCreator = "";
BinCreator = BinCreatorStr;
}
if (BinCreator.empty())
@ -253,15 +255,14 @@ int cmCPackIFWGenerator::InitializeInternal()
// 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 =
this->GetOption("CPACK_IFW_REPOGEN_EXECUTABLE");
RepoGen = ifwRepoGenStr ? ifwRepoGenStr : "";
RepoGen = "";
}
else
{
RepoGen = "";
RepoGen = RepoGenStr;
}
// Variables that Change Behavior