Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit f63d011

Browse files
committed
Generate and use config.h
1 parent c00a2f6 commit f63d011

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

src/Native/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ else ()
2424
message(FATAL_ERROR "Unknown build type. Set CMAKE_BUILD_TYPE to DEBUG or RELEASE.")
2525
endif ()
2626

27+
include(configure.cmake)
28+
2729
add_subdirectory(System.IO.Native)
2830
add_subdirectory(System.Security.Cryptography.Native)
29-

src/Native/System.IO.Native/nativeio.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
44
//
55

6+
#include "../config.h"
67
#include "nativeio.h"
78
#include <sys/stat.h>
89

src/Native/config.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#pragma once
2+
3+
#cmakedefine01 HAVE_STAT64
4+
#cmakedefine01 HAVE_STAT_BIRTHTIME

src/Native/configure.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include(CheckFunctionExists)
2+
include(CheckStructHasMember)
3+
4+
check_function_exists(stat64 HAVE_STAT64)
5+
check_struct_has_member("struct stat" st_birthtime "sys/types.h;sys/stat.h" HAVE_STAT_BIRTHTIME)
6+
7+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)

0 commit comments

Comments
 (0)