First draft of cmake port

feature/tap-sh
Dan Kegel 2017-06-04 15:17:51 -07:00
parent f7e9d61f4d
commit 251f747343
3 changed files with 85 additions and 0 deletions

61
CMakeLists.txt Normal file
View File

@ -0,0 +1,61 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1)
PROJECT(pkgconf C)
SET(PACKAGE_BUGREPORT http://github.com/pkgconf/pkgconf/issues)
SET(PACKAGE_NAME pkgconf)
SET(PACKAGE_VERSION 1.3.7)
# Expand config.h
INCLUDE (CheckIncludeFiles)
CHECK_INCLUDE_FILES(sys/stat.h HAVE_SYS_STAT_H)
INCLUDE (CheckFunctionExists)
CHECK_FUNCTION_EXISTS(strlcpy HAVE_STRLCPY)
CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT)
CHECK_FUNCTION_EXISTS(strndup HAVE_STRNDUP)
CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH)
SET(abs_top_srcdir ${pkgconf_SOURCE_DIR})
CONFIGURE_FILE(libpkgconf/config.h.cmake.in libpkgconf/config.h @ONLY)
# Expand others
FOREACH(file Kyuafile libpkgconf.pc tests/Kyuafile tests/test_env.sh)
CONFIGURE_FILE(${file}.in ${file} @ONLY)
ENDFOREACH()
IF (WIN32)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wx")
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat=2 -std=gnu99")
ENDIF()
INCLUDE_DIRECTORIES(${pkgconf_SOURCE_DIR} ${pkgconf_BINARY_DIR})
ADD_DEFINITIONS(-DPKG_DEFAULT_PATH=\"$(pkg_default_dir)\")
ADD_DEFINITIONS(-DSYSTEM_INCLUDEDIR=\"$(system_includedir)\")
ADD_DEFINITIONS(-DSYSTEM_LIBDIR=\"$(system_libdir)\")
ADD_SUBDIRECTORY(libpkgconf)
INCLUDE_DIRECTORIES(${libpkgconf_BINARY_DIR})
ADD_EXECUTABLE(pkgconf main.c getopt_long.c)
TARGET_LINK_LIBRARIES(pkgconf libpkgconf)
ENABLE_TESTING()
SET(test_scripts
tests/basic
tests/builtins
tests/conflicts
tests/framework
tests/parser
tests/provides
tests/regress
tests/requires
tests/sysroot
tests/version
)
# No accounting for taste
FOREACH(file ${test_scripts})
CONFIGURE_FILE(${file}.sh ${file} @ONLY)
ENDFOREACH()
ADD_TEST(kyua
kyua --config=none test --kyuafile=${pkgconf_BINARY_DIR}/Kyuafile --build-root=${pkgconf_BINARY_DIR}
)

16
libpkgconf/CMakeLists.txt Normal file
View File

@ -0,0 +1,16 @@
PROJECT(libpkgconf C)
ADD_LIBRARY(libpkgconf
argvsplit.c
audit.c
bsdstubs.c
cache.c
client.c
dependency.c
fileio.c
fragment.c
path.c
pkg.c
queue.c
tuple.c
)

View File

@ -0,0 +1,8 @@
#cmakedefine HAVE_CYGWIN_CONV_PATH
#cmakedefine HAVE_STRLCAT
#cmakedefine HAVE_STRLCPY
#cmakedefine HAVE_STRNDUP
#cmakedefine HAVE_SYS_STAT_H
#cmakedefine PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"