-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
37 additions
and
18 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 |
---|---|---|
@@ -1,19 +1,23 @@ | ||
if ($ENV{CI}) | ||
string(LENGTH $ENV{LIBCGSS_VERSION_MAJOR} VERSION_INFO_LENGTH) | ||
if (DEFINED ENV{LIBCGSS_VERSION_MAJOR) | ||
string(LENGTH $ENV{LIBCGSS_VERSION_MAJOR} VERSION_INFO_LENGTH) | ||
|
||
if (VERSION_INFO_LENGTH GREATER 0) | ||
# If we are in a CI environment, load version info from environment variables (see configure-cmake.ps1) | ||
set(PROJECT_VERSION_MAJOR $ENV{LIBCGSS_VERSION_MAJOR}) | ||
set(PROJECT_VERSION_MINOR $ENV{LIBCGSS_VERSION_MINOR}) | ||
set(PROJECT_VERSION_PATCH $ENV{LIBCGSS_VERSION_PATCH}) | ||
set(PROJECT_VERSION_TWEAK $ENV{LIBCGSS_VERSION_TWEAK}) | ||
if (VERSION_INFO_LENGTH GREATER 0) | ||
# If we are in a CI environment, load version info from environment variables (see configure-cmake.ps1) | ||
set(PROJECT_VERSION_MAJOR $ENV{LIBCGSS_VERSION_MAJOR}) | ||
set(PROJECT_VERSION_MINOR $ENV{LIBCGSS_VERSION_MINOR}) | ||
set(PROJECT_VERSION_PATCH $ENV{LIBCGSS_VERSION_PATCH}) | ||
set(PROJECT_VERSION_TWEAK $ENV{LIBCGSS_VERSION_TWEAK}) | ||
|
||
set_target_properties(cgss | ||
PROPERTIES | ||
VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK}" | ||
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" | ||
) | ||
set_target_properties(cgss | ||
PROPERTIES | ||
VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK}" | ||
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" | ||
) | ||
else () | ||
message(WARNING "Warning: CI environment detected but libcgss version is empty.") | ||
endif () | ||
else () | ||
message(WARNING "Warning: CI environment detected but libcgss version is not set.") | ||
message(WARNING "Warning: CI environment detected but libcgss version is not defined.") | ||
endif () | ||
endif () |
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,13 @@ | ||
function Set-PersistentEnvironmentVariable([String] $name, [String]$value) | ||
{ | ||
if ($IsWindows) | ||
{ | ||
[Environment]::SetEnvironmentVariable($name, $value, [EnvironmentVariableTarget]::User) | ||
} | ||
else | ||
{ | ||
# There is still no way to persist *nix environment variables in PowerShell (PowerShell/PowerShell#4341). | ||
# But this function should run in root scope and all CMake processes are its child so we should be OK. | ||
Set-Item -Path "env:$name" -Value $value | ||
} | ||
} |