Skip to content

Commit ab71b2d

Browse files
committed
Make version library a interface.
1 parent 8e293b8 commit ab71b2d

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

source/version/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ string(TOUPPER ${META_PROJECT_NAME} META_PROJECT_NAME_UPPER)
3434
string(TOLOWER ${META_PROJECT_NAME} META_PROJECT_NAME_LOWER)
3535

3636
set(template_include_path "${CMAKE_CURRENT_SOURCE_DIR}/include/${target}")
37-
set(template_source_path "${CMAKE_CURRENT_SOURCE_DIR}/source")
3837

3938
set(include_path "${CMAKE_BINARY_DIR}/source/include/${META_PROJECT_NAME_LOWER}")
40-
set(source_path "${CMAKE_BINARY_DIR}/source/${META_PROJECT_NAME_LOWER}/source")
39+
set(source_path "${CMAKE_CURRENT_SOURCE_DIR}/source")
4140

4241
# Generate version-header
4342
configure_file(${template_include_path}/version.h.in ${include_path}/${META_PROJECT_NAME_LOWER}_version.h)
@@ -46,6 +45,10 @@ set(headers
4645
${include_path}/${META_PROJECT_NAME_LOWER}_version.h
4746
)
4847

48+
set(sources
49+
${source_path}/version.c
50+
)
51+
4952
# Group source files
5053
set(header_group "Header Files (API)")
5154
set(source_group "Source Files")
@@ -59,6 +62,7 @@ source_group_by_path(${include_path} "\\\\.h$|\\\\.hpp$"
5962
# Build library
6063
add_library(${target}
6164
${headers}
65+
${sources}
6266
)
6367

6468
# Create namespaced alias

source/version/source/version.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* CMake Versioning Utility by Parra Studios
3+
* A template for generating versioning utilities.
4+
*
5+
* Copyright (C) 2016 - 2021 Vicente Eduardo Ferrer Garcia <[email protected]>
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*
19+
*/
20+
21+
#include <metacall/metacall_version.h>
22+
23+
const char *version_print_info()
24+
{
25+
static const char version_info[] =
26+
"Abstract Data Type Library " METACALL_VERSION "\n"
27+
"Copyright (C) 2016 - 2021 Vicente Eduardo Ferrer Garcia <[email protected]>\n"
28+
29+
#ifdef ADT_STATIC_DEFINE
30+
"Compiled as static library type"
31+
#else
32+
"Compiled as shared library type"
33+
#endif
34+
35+
"\n";
36+
37+
return version_info;
38+
}

0 commit comments

Comments
 (0)