-
Notifications
You must be signed in to change notification settings - Fork 709
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #290 from bast/radovan/version-in-project
define VERSION inside project(); fixes #278
- Loading branch information
Showing
6 changed files
with
20 additions
and
27 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,13 +1,12 @@ | ||
#include <stdio.h> | ||
|
||
// provides VERSION_MAJOR, VERSION_MINOR, and VERSION_PATCH | ||
// provides PROJECT_VERSION, PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR | ||
#include "version.h" | ||
|
||
int main() { | ||
printf("This is output from example code v%i.%i.%i:\n", | ||
VERSION_MAJOR, | ||
VERSION_MINOR, | ||
VERSION_PATCH); | ||
printf("This is output from example code %s\n", PROJECT_VERSION); | ||
printf("The major version number is %i\n", PROJECT_VERSION_MAJOR); | ||
printf("The minor version number is %i\n", PROJECT_VERSION_MINOR); | ||
|
||
printf("Hello CMake world!\n"); | ||
} |
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,5 +1,7 @@ | ||
#pragma once | ||
|
||
#define VERSION_MAJOR @VERSION_MAJOR@ | ||
#define VERSION_MINOR @VERSION_MINOR@ | ||
#define VERSION_PATCH @VERSION_PATCH@ | ||
#define PROJECT_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ | ||
#define PROJECT_VERSION_MINOR @PROJECT_VERSION_MINOR@ | ||
#define PROJECT_VERSION_PATCH @PROJECT_VERSION_PATCH@ | ||
|
||
#define PROJECT_VERSION "v@PROJECT_VERSION@" |
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,11 +1,13 @@ | ||
program example | ||
|
||
use version, only: VERSION_STRING, VERSION_MAJOR | ||
use version, only: PROJECT_VERSION, PROJECT_VERSION_MAJOR, PROJECT_VERSION_MINOR | ||
|
||
implicit none | ||
|
||
print *, "This is output from example code ", VERSION_STRING | ||
print *, "The major version number is", VERSION_MAJOR | ||
print *, "This is output from example code ", PROJECT_VERSION | ||
print *, "The major version number is", PROJECT_VERSION_MAJOR | ||
print *, "The minor version number is", PROJECT_VERSION_MINOR | ||
|
||
print *, "Hello CMake world!" | ||
|
||
end program |
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