Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake #28

Merged
merged 9 commits into from
May 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ libcgi.so
autom4te.cache
configure
src/config.h
*swp
76 changes: 76 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#
# Copyright 2013,2016 Alexander Dahl <[email protected]>
#
cmake_minimum_required(VERSION 2.8.8)

project(cgi)
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LC)
set(LIBPREFIX ${PROJECT_NAME})
set(LIBPREFIX_LC ${PROJECT_NAME_LC})
set(LIBPREFIX_UC ${PROJECT_NAME_UC})

set(PROJECT_VERSION_MAJOR 1)
set(PROJECT_VERSION_MINOR 1)
set(PROJECT_VERSION_PATCH 0)
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
message(STATUS "PROJECT_VERSION: ${PROJECT_VERSION}")

set(CGI_DESCRIPTION "A C library to build CGI applications.")
set(CGI_URL "https://github.com/rafaelsteil/libcgi")

# includes
include(CMakePackageConfigHelpers) # cmake 2.8.8
include(FeatureSummary)
include(GNUInstallDirs) # cmake 2.8.5

# additional compiler flags
add_definitions(-Wall -Wextra -Wcast-align)

# subdirectories
add_subdirectory("src")

# cmake package stuff
configure_package_config_file(${PROJECT_NAME_LC}-config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LC}-config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LC}-config-version.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LC}-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LC}-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)

# pkg-config stuff
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/libcgi.pc.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/libcgi.pc"
@ONLY
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/libcgi.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)

# feature summary
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
feature_summary(WHAT ALL)

# packaging
set(CPACK_PACKAGE_NAME "libcgi")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CGI_DESCRIPTION}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set(CPACK_SOURCE_IGNORE_FILES "/\\\\.kdev4/;\\\\.kdev4$;/\\\\.git/;\\\\.gitignore;\\\\.swp$")
include(CPack)
94 changes: 0 additions & 94 deletions Makefile.in

This file was deleted.

20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ It was my first Open Source project, somewhere back in the 2000s and somethings.

Building
--------
* Type _./configure_ and then _make_
* To clean, type _make clean_
* To remove library files, type _make uninstall_
* At the _examples/_ directory you'll find some code to start with
LibCGI is built with [CMake](https://cmake.org/). One quick way:

* create a build directory and change into it

mkdir build
cd build

* call cmake

cmake ..

* build it

make

Of course every other way CMake provides would also work, see CMake documentation.

TODO
----
Expand Down
6 changes: 0 additions & 6 deletions autogen.sh

This file was deleted.

21 changes: 21 additions & 0 deletions cgi-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Copyright 2013,2016 Alexander Dahl <[email protected]>
#

# paths
@PACKAGE_INIT@
set_and_check(CGI_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@/lib@PROJECT_NAME@")

# targets
get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(NOT TARGET @PROJECT_NAME@-shared)
include("${_dir}/@[email protected]")
endif(NOT TARGET @PROJECT_NAME@-shared)
set(CGI_LIBRARIES @PROJECT_NAME@-shared)

# feature summary
include(FeatureSummary)
set_package_properties(@PROJECT_NAME_UC@ PROPERTIES
DESCRIPTION "@CGI_DESCRIPTION@"
URL "@CGI_URL@"
)
16 changes: 0 additions & 16 deletions configure.in

This file was deleted.

Empty file removed examples/guestbook/Makefile.am
Empty file.
Empty file removed examples/redirect/Makefile.am
Empty file.
Empty file.
Empty file removed examples/simple_form/Makefile.am
Empty file.
Loading