Skip to content

Commit a17f2a6

Browse files
committed
Compiling/Installing : The CFGDIR parameter was removed. Use FILESDIR instead.
1 parent 04bb6c0 commit a17f2a6

17 files changed

+215
-188
lines changed

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,8 @@ matrix:
7171
- git clean -dfx
7272
# check what happens if we want to install it to some other dir,
7373
- echo $CXXFLAGS
74-
- make -s MATCHCOMPILER=yes CFGDIR=/usr/share/cppcheck/cfg -j 2
75-
- sudo make MATCHCOMPILER=yes CFGDIR=/usr/share/cppcheck/cfg install
76-
- sudo mkdir -p /usr/share/cppcheck/cfg
77-
- sudo install -D ./cfg/* -t /usr/share/cppcheck/cfg
74+
- make -s MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck -j 2
75+
- sudo make MATCHCOMPILER=yes FILESDIR=/usr/share/cppcheck install
7876
# check if it actually works:
7977
- /usr/bin/cppcheck ./cli
8078
# check if showtime=top5 works

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ include(cmake/cxx11.cmake REQUIRED)
1313

1414
use_cxx11()
1515

16+
file(GLOB addons "addons/*.py")
1617
file(GLOB cfgs "cfg/*.cfg")
18+
file(GLOB platforms "platforms/*.xml")
1719

1820
if (BUILD_TESTS)
1921
enable_testing()

Makefile

Lines changed: 137 additions & 127 deletions
Large diffs are not rendered by default.

cli/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ install(TARGETS cppcheck
2323
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
2424
COMPONENT applications)
2525

26+
install(FILES ${addons}
27+
DESTINATION ${FILESDIR}/addons
28+
COMPONENT headers)
29+
2630
install(FILES ${cfgs}
27-
DESTINATION ${CFGDIR}/
31+
DESTINATION ${FILESDIR}/cfg
2832
COMPONENT headers)
33+
34+
install(FILES ${platforms}
35+
DESTINATION ${FILESDIR}/platforms
36+
COMPONENT headers)
37+

cli/cppcheckexecutor.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -832,14 +832,14 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
832832
if (!std || !posix || !windows) {
833833
const std::list<ErrorLogger::ErrorMessage::FileLocation> callstack;
834834
const std::string msg("Failed to load " + std::string(!std ? "std.cfg" : !posix ? "posix.cfg" : "windows.cfg") + ". Your Cppcheck installation is broken, please re-install.");
835-
#ifdef CFGDIR
836-
const std::string details("The Cppcheck binary was compiled with CFGDIR set to \"" +
837-
std::string(CFGDIR) + "\" and will therefore search for "
838-
"std.cfg in that path.");
835+
#ifdef FILESDIR
836+
const std::string details("The Cppcheck binary was compiled with FILESDIR set to \""
837+
FILESDIR "\" and will therefore search for "
838+
"std.cfg in " FILESDIR "/cfg.");
839839
#else
840840
const std::string cfgfolder(Path::fromNativeSeparators(Path::getPathFromFilename(argv[0])) + "cfg");
841-
const std::string details("The Cppcheck binary was compiled without CFGDIR set. Either the "
842-
"std.cfg should be available in " + cfgfolder + " or the CFGDIR "
841+
const std::string details("The Cppcheck binary was compiled without FILESDIR set. Either the "
842+
"std.cfg should be available in " + cfgfolder + " or the FILESDIR "
843843
"should be configured.");
844844
#endif
845845
ErrorLogger::ErrorMessage errmsg(callstack, emptyString, Severity::information, msg+" "+details, "failedToLoadCfg", false);

cmake/compilerDefinitions.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ if (UNIX)
55
if (HAVE_RULES)
66
add_definitions(-DHAVE_RULES -DTIXML_USE_STL)
77
endif()
8-
add_definitions(-DCFGDIR="${CFGDIR}")
8+
add_definitions(-DFILESDIR="${FILESDIR}")
99
endif()

cmake/options.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
4848
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
4949
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
5050

51-
set(CFGDIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME} CACHE STRING "CFG files directory")
51+
set(FILESDIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME} CACHE STRING "Cppcheck files directory")
5252

gui/mainwindow.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -746,14 +746,14 @@ Library::Error MainWindow::loadLibrary(Library *library, const QString &filename
746746
if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
747747
return ret;
748748

749-
#ifdef CFGDIR
750-
// Try to load the library from CFGDIR..
751-
const QString cfgdir = CFGDIR;
752-
if (!cfgdir.isEmpty()) {
753-
ret = library->load(nullptr, (cfgdir+"/"+filename).toLatin1());
749+
#ifdef FILESDIR
750+
// Try to load the library from FILESDIR/cfg..
751+
const QString filesdir = FILESDIR;
752+
if (!filesdir.isEmpty()) {
753+
ret = library->load(nullptr, (filesdir+"/cfg/"+filename).toLatin1());
754754
if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
755755
return ret;
756-
ret = library->load(nullptr, (cfgdir+"/cfg/"+filename).toLatin1());
756+
ret = library->load(nullptr, (filesdir+filename).toLatin1());
757757
if (ret.errorcode != Library::ErrorCode::FILE_NOT_FOUND)
758758
return ret;
759759
}

gui/projectfiledialog.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,12 @@ ProjectFileDialog::ProjectFileDialog(ProjectFile *projectFile, QWidget *parent)
7676
const QString applicationFilePath = QCoreApplication::applicationFilePath();
7777
const QString appPath = QFileInfo(applicationFilePath).canonicalPath();
7878
QSettings settings;
79-
#ifdef CFGDIR
80-
const QString cfgdir = CFGDIR;
81-
#endif
8279
const QString datadir = settings.value("DATADIR",QString()).toString();
8380
QStringList searchPaths;
8481
searchPaths << appPath << appPath + "/cfg" << inf.canonicalPath();
85-
#ifdef CFGDIR
86-
if (!cfgdir.isEmpty())
87-
searchPaths << cfgdir << cfgdir + "/cfg";
82+
#ifdef FILESDIR
83+
if (FILESDIR[0])
84+
searchPaths << FILESDIR << FILESDIR "/cfg";
8885
#endif
8986
if (!datadir.isEmpty())
9087
searchPaths << datadir << datadir + "/cfg";

lib/cppcheck.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ namespace {
7474
if (Path::fileExists(exepath + "addons/" + fileName))
7575
return exepath + "addons/" + fileName;
7676

77-
#ifdef CFGDIR
78-
if (Path::fileExists(CFGDIR + fileName))
79-
return CFGDIR + fileName;
80-
if (Path::fileExists(CFGDIR + ("../addons/" + fileName)))
81-
return CFGDIR + ("../addons/" + fileName);
77+
#ifdef FILESDIR
78+
if (Path::fileExists(FILESDIR + ("/" + fileName)))
79+
return FILESDIR + ("/" + fileName);
80+
if (Path::fileExists(FILESDIR + ("/addons/" + fileName)))
81+
return FILESDIR + ("/addons/" + fileName);
8282
#endif
8383
return "";
8484
}

0 commit comments

Comments
 (0)