Add minimal CMake build files
This commit is contained in:
parent
27224cdd4c
commit
2248f9e3aa
2 changed files with 58 additions and 0 deletions
45
CMakeLists.txt
Normal file
45
CMakeLists.txt
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
project(sj3 VERSION 2.0.99 LANGUAGES C)
|
||||||
|
|
||||||
|
include(CheckCSourceCompiles)
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_C_STANDARD)
|
||||||
|
set(CMAKE_C_STANDARD 90)
|
||||||
|
endif()
|
||||||
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_C_EXTENSIONS OFF)
|
||||||
|
|
||||||
|
set(SJ3CONFDIR "/etc/sj3" CACHE PATH "SJ3 configuration directory")
|
||||||
|
set(SJ3DICTDIR "${CMAKE_INSTALL_PREFIX}/share/sj3/dict" CACHE PATH
|
||||||
|
"SJ3 dictionary directory")
|
||||||
|
|
||||||
|
check_c_source_compiles("
|
||||||
|
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
|
||||||
|
# error C99 required
|
||||||
|
#endif
|
||||||
|
#include <stdint.h>
|
||||||
|
int main(void) {
|
||||||
|
uint8_t u8 = 0;
|
||||||
|
uint16_t u16 = 0;
|
||||||
|
uint32_t u32 = 0;
|
||||||
|
uint64_t u64 = 0;
|
||||||
|
return (int)(u8 + u16 + u32 + u64);
|
||||||
|
}
|
||||||
|
" HAVE_C99_STDINT)
|
||||||
|
|
||||||
|
configure_file(config.h.cmake config.h @ONLY)
|
||||||
|
configure_file(Paths.h.in Paths.h @ONLY)
|
||||||
|
|
||||||
|
add_library(sj3types INTERFACE)
|
||||||
|
target_include_directories(sj3types INTERFACE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(sj3_core_types OBJECT
|
||||||
|
wc16_str.c
|
||||||
|
string.c
|
||||||
|
string2.c
|
||||||
|
)
|
||||||
|
target_link_libraries(sj3_core_types PRIVATE sj3types)
|
||||||
13
config.h.cmake
Normal file
13
config.h.cmake
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef OCONFIGURE_CONFIG_H
|
||||||
|
#define OCONFIGURE_CONFIG_H
|
||||||
|
|
||||||
|
#cmakedefine01 HAVE_C99_STDINT
|
||||||
|
|
||||||
|
#ifndef HAVE_MD5
|
||||||
|
# define HAVE_MD5 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAVE_SHA2
|
||||||
|
# define HAVE_SHA2 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* OCONFIGURE_CONFIG_H */
|
||||||
Loading…
Add table
Add a link
Reference in a new issue