cmake: add missing configure variables, install headers and .pc file, use simpler line to invoke kyua, tweak build location of dll for ease of testing

pull/119/head
Dan Kegel 2017-06-05 17:40:10 -07:00
parent 4ba2bac538
commit ededaa6415
2 changed files with 20 additions and 7 deletions

View File

@ -14,9 +14,14 @@ CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT)
CHECK_FUNCTION_EXISTS(strndup HAVE_STRNDUP) CHECK_FUNCTION_EXISTS(strndup HAVE_STRNDUP)
CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH) CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH)
SET(abs_top_srcdir ${pkgconf_SOURCE_DIR}) SET(abs_top_srcdir ${pkgconf_SOURCE_DIR})
SET(prefix ${CMAKE_INSTALL_PREFIX})
SET(exec_prefix ${CMAKE_INSTALL_PREFIX})
SET(datarootdir ${CMAKE_INSTALL_PREFIX}/share)
SET(libdir ${CMAKE_INSTALL_PREFIX}/lib)
SET(PKGCONFIGDIR "${libdir}/pkgconfig:${datarootdir}/pkgconfig")
CONFIGURE_FILE(libpkgconf/config.h.cmake.in libpkgconf/config.h @ONLY) CONFIGURE_FILE(libpkgconf/config.h.cmake.in libpkgconf/config.h @ONLY)
# Expand others # Handy that these files need configuring; cygwin atf doesn't like windows line endings, and NEWLINE_STYLE helps.
FOREACH(file Kyuafile libpkgconf.pc tests/Kyuafile tests/test_env.sh) FOREACH(file Kyuafile tests/Kyuafile tests/test_env.sh)
CONFIGURE_FILE(${file}.in ${file} @ONLY NEWLINE_STYLE UNIX) CONFIGURE_FILE(${file}.in ${file} @ONLY NEWLINE_STYLE UNIX)
ENDFOREACH() ENDFOREACH()
@ -34,6 +39,8 @@ ADD_DEFINITIONS(-DPKG_DEFAULT_PATH=\"$(pkg_default_dir)\")
ADD_DEFINITIONS(-DSYSTEM_INCLUDEDIR=\"$(system_includedir)\") ADD_DEFINITIONS(-DSYSTEM_INCLUDEDIR=\"$(system_includedir)\")
ADD_DEFINITIONS(-DSYSTEM_LIBDIR=\"$(system_libdir)\") ADD_DEFINITIONS(-DSYSTEM_LIBDIR=\"$(system_libdir)\")
# Place shared libraries in same place as binary, for ease of setting PATH in test_env.sh
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${pkgconf_BINARY_DIR})
ADD_SUBDIRECTORY(libpkgconf) ADD_SUBDIRECTORY(libpkgconf)
INCLUDE_DIRECTORIES(${libpkgconf_BINARY_DIR}) INCLUDE_DIRECTORIES(${libpkgconf_BINARY_DIR})
@ -55,11 +62,9 @@ SET(test_scripts
tests/sysroot tests/sysroot
tests/version tests/version
) )
# No accounting for taste # Handy that these files need configuring; cygwin atf doesn't like windows line endings, and NEWLINE_STYLE helps.
FOREACH(file ${test_scripts}) FOREACH(file ${test_scripts})
CONFIGURE_FILE(${file}.sh ${file} @ONLY NEWLINE_STYLE UNIX) CONFIGURE_FILE(${file}.sh ${file} @ONLY NEWLINE_STYLE UNIX)
ENDFOREACH() ENDFOREACH()
ADD_TEST(kyua ADD_TEST(kyua kyua --config=none test)
kyua --config=none test --kyuafile=${pkgconf_BINARY_DIR}/Kyuafile --build-root=${pkgconf_BINARY_DIR}
)

View File

@ -18,9 +18,17 @@ ADD_LIBRARY(libpkgconf SHARED
queue.c queue.c
tuple.c tuple.c
) )
SET_TARGET_PROPERTIES(libpkgconf PROPERTIES VERSION "2.0.0" SOVERSION 2)
INSTALL(TARGETS libpkgconf INSTALL(TARGETS libpkgconf
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib ARCHIVE DESTINATION lib
) )
SET_TARGET_PROPERTIES(libpkgconf PROPERTIES VERSION "2.0.0" SOVERSION 2) INSTALL(
FILES bsdstubs.h iter.h libpkgconf.h libpkgconf-api.h stdinc.h
DESTINATION include/libpkgconf
)
# Hypothesis: .pc files are a Unix thing, should always have unix line endings.
CONFIGURE_FILE(${pkgconf_SOURCE_DIR}/libpkgconf.pc.in libpkgconf.pc @ONLY NEWLINE_STYLE UNIX)
INSTALL(FILES ${libpkgconf_BINARY_DIR}/libpkgconf.pc DESTINATION lib/pkgconfig)