forked from ccache/ccache
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Move Windows config and cache to LOCALAPPDATA
Add a variadic template helper function PATH(...) to construct native paths using std::filesystem. Fix-up default cmake install directories and set system-wide config to C:\ProgramData\ccache\ccache.conf on Windows. Update manual to describe behavior specific to Windows and cache directory finding heuristics on all systems. Fix ccache#1023 Fix ccache#946 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
- Loading branch information
Showing
7 changed files
with
168 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
if(WIN32) | ||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | ||
set(program_files "$ENV{ProgramFiles}") | ||
|
||
# For 32 bit builds. | ||
if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND ENV{ProgramFiles\(x86\)}) | ||
set(program_files "$ENV{ProgramFiles\(x86\)}") | ||
endif() | ||
|
||
if(NOT program_files) | ||
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 4) | ||
set(program_files "/Program Files") | ||
else() | ||
set(program_files "/Program Files (x86)") | ||
endif() | ||
endif() | ||
|
||
file(TO_CMAKE_PATH "${program_files}/ccache" CMAKE_INSTALL_PREFIX) | ||
|
||
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE STRING "System-wide installation prefix" FORCE) | ||
endif() | ||
|
||
if(NOT CMAKE_INSTALL_SYSCONFDIR) | ||
set(program_data "$ENV{ALLUSERSPROFILE}") | ||
|
||
if(NOT program_data) | ||
set(program_data "/ProgramData") | ||
endif() | ||
|
||
file(TO_CMAKE_PATH "${program_data}/ccache" CMAKE_INSTALL_SYSCONFDIR) | ||
|
||
set(CMAKE_INSTALL_SYSCONFDIR "${CMAKE_INSTALL_SYSCONFDIR}" CACHE PATH "System-wide config file location" FORCE) | ||
endif() | ||
|
||
set(CMAKE_INSTALL_BINDIR "" CACHE PATH "executables subdirectory" FORCE) | ||
set(CMAKE_INSTALL_SBINDIR "" CACHE PATH "system administration executables subdirectory" FORCE) | ||
set(CMAKE_INSTALL_LIBEXECDIR "" CACHE PATH "dependent executables subdirectory" FORCE) | ||
set(CMAKE_INSTALL_LIBDIR "" CACHE PATH "object libraries subdirectory" FORCE) | ||
endif() | ||
|
||
include(GNUInstallDirs) | ||
|
||
# Escape SYSCONFDIR for a C macro in config.h . | ||
file(TO_NATIVE_PATH "${CMAKE_INSTALL_FULL_SYSCONFDIR}" CONFIG_SYSCONFDIR_C_ESCAPED) | ||
|
||
string(REPLACE "\\" "\\\\" CONFIG_SYSCONFDIR_C_ESCAPED "${CONFIG_SYSCONFDIR_C_ESCAPED}") | ||
|
||
set( | ||
CONFIG_SYSCONFDIR_C_ESCAPED "${CONFIG_SYSCONFDIR_C_ESCAPED}" CACHE STRING | ||
"System-wide config file location, CMAKE_INSTALL_FULL_SYSCONFDIR, escaped for a C macro in config.h" | ||
FORCE | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters