-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from sjinks/refactor-cmake
build: refactoring
- Loading branch information
Showing
8 changed files
with
401 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
* | ||
!CMakeLists.txt | ||
!cmake | ||
!src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# - Try to find libev | ||
# Once done this will define | ||
# LIBADA_FOUND - System has libada | ||
# LIBADA_INCLUDE_DIRS - The libada include directories | ||
# LIBADA_LIBRARIES - The libraries needed to use libada | ||
# LIBADA_STATIC_INCLUDE_DIRS - The libada static include directories | ||
# LIBADA_STATIC_LIBRARIES - The libraries needed to use libada statically | ||
|
||
find_path( | ||
LIBADA_INCLUDE_DIR | ||
NAMES ada.h | ||
) | ||
|
||
set(SAVED_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}") | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}") | ||
find_library(LIBADA_STATIC_LIBRARY NAMES ada) | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}") | ||
find_library(LIBADA_SHARED_LIBRARY NAMES ada) | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES "${SAVED_CMAKE_FIND_LIBRARY_SUFFIXES}") | ||
unset(SAVED_CMAKE_FIND_LIBRARY_SUFFIXES) | ||
|
||
if(LIBADA_SHARED_LIBRARY) | ||
set(LIBADA_LIBRARY ${LIBADA_SHARED_LIBRARY}) | ||
elseif(LIBADA_STATIC_LIBRARY) | ||
set(LIBADA_LIBRARY ${LIBADA_STATIC_LIBRARY}) | ||
endif() | ||
|
||
if(LIBADA_INCLUDE_DIR) | ||
file(STRINGS "${LIBADA_INCLUDE_DIR}/ada/ada_version.h" LIBADA_VERSION REGEX "^#define[ \t]ADA_VERSION[ \t]\"[^\"]+\"$") | ||
string(REGEX REPLACE "\"([^\"]+)\"" "\\1" LIBADA_VERSION "${LIBADA_VERSION}") | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( | ||
libada | ||
REQUIRED_VARS LIBADA_LIBRARY LIBADA_INCLUDE_DIR | ||
VERSION_VAR LIBADA_VERSION | ||
) | ||
|
||
if(LIBADA_FOUND) | ||
if(LIBADA_SHARED_LIBRARY) | ||
set(LIBADA_LIBRARIES ${LIBADA_SHARED_LIBRARY}) | ||
else() | ||
set(LIBADA_LIBRARIES ${LIBADA_STATIC_LIBRARY}) | ||
endif() | ||
|
||
set(LIBADA_INCLUDE_DIRS ${LIBADA_INCLUDE_DIR}) | ||
|
||
set(LIBADA_STATIC_INCLUDE_DIRS ${LIBADA_INCLUDE_DIRS}) | ||
if(LIBADA_STATIC_LIBRARY) | ||
set(LIBADA_STATIC_LIBRARIES ${LIBADA_STATIC_LIBRARY}) | ||
endif() | ||
endif() | ||
|
||
mark_as_advanced(LIBADA_INCLUDE_DIR LIBADA_SHARED_LIBRARY LIBADA_STATIC_LIBRARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# - Try to find libev | ||
# Once done this will define | ||
# LIBEV_FOUND - System has libev | ||
# LIBEV_INCLUDE_DIRS - The libev include directories | ||
# LIBEV_LIBRARIES - The libraries needed to use libev | ||
# LIBEV_STATIC_INCLUDE_DIRS - The libev static include directories | ||
# LIBEV_STATIC_LIBRARIES - The libraries needed to use libev statically | ||
|
||
find_path( | ||
LIBEV_INCLUDE_DIR | ||
NAMES ev.h | ||
) | ||
|
||
set(SAVED_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}") | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}") | ||
find_library(LIBEV_STATIC_LIBRARY NAMES ev) | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}") | ||
find_library(LIBEV_SHARED_LIBRARY NAMES ev) | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES "${SAVED_CMAKE_FIND_LIBRARY_SUFFIXES}") | ||
unset(SAVED_CMAKE_FIND_LIBRARY_SUFFIXES) | ||
|
||
if(LIBEV_SHARED_LIBRARY) | ||
set(LIBEV_LIBRARY ${LIBEV_SHARED_LIBRARY}) | ||
elseif(LIBEV_STATIC_LIBRARY) | ||
set(LIBEV_LIBRARY ${LIBEV_STATIC_LIBRARY}) | ||
endif() | ||
|
||
if(LIBEV_INCLUDE_DIR) | ||
file( | ||
STRINGS "${LIBEV_INCLUDE_DIR}/ev.h" | ||
LIBEV_VERSION_MAJOR REGEX "^#define[ \t]+EV_VERSION_MAJOR[ \t]+[0-9]+" | ||
) | ||
|
||
file( | ||
STRINGS "${LIBEV_INCLUDE_DIR}/ev.h" | ||
LIBEV_VERSION_MINOR REGEX "^#define[ \t]+EV_VERSION_MINOR[ \t]+[0-9]+" | ||
) | ||
|
||
string(REGEX REPLACE "[^0-9]+" "" LIBEV_VERSION_MAJOR "${LIBEV_VERSION_MAJOR}") | ||
string(REGEX REPLACE "[^0-9]+" "" LIBEV_VERSION_MINOR "${LIBEV_VERSION_MINOR}") | ||
set(LIBEV_VERSION "${LIBEV_VERSION_MAJOR}.${LIBEV_VERSION_MINOR}") | ||
unset(LIBEV_VERSION_MINOR) | ||
unset(LIBEV_VERSION_MAJOR) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( | ||
libev | ||
REQUIRED_VARS LIBEV_LIBRARY LIBEV_INCLUDE_DIR | ||
VERSION_VAR LIBEV_VERSION | ||
) | ||
|
||
if(LIBEV_FOUND) | ||
if(LIBEV_SHARED_LIBRARY) | ||
set(LIBEV_LIBRARIES ${LIBEV_SHARED_LIBRARY}) | ||
else() | ||
set(LIBEV_LIBRARIES ${LIBEV_STATIC_LIBRARY};m) | ||
endif() | ||
|
||
set(LIBEV_INCLUDE_DIRS ${LIBEV_INCLUDE_DIR}) | ||
|
||
set(LIBEV_STATIC_INCLUDE_DIRS ${LIBEV_INCLUDE_DIRS}) | ||
if(LIBEV_STATIC_LIBRARY) | ||
set(LIBEV_STATIC_LIBRARIES ${LIBEV_STATIC_LIBRARY};m) | ||
endif() | ||
endif() | ||
|
||
mark_as_advanced(LIBEV_INCLUDE_DIR LIBEV_SHARED_LIBRARY LIBEV_STATIC_LIBRARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# - Try to find libev | ||
# Once done this will define | ||
# LIBLLHTTP_FOUND - System has llhttp | ||
# LIBLLHTTP_INCLUDE_DIRS - The llhttp include directories | ||
# LIBLLHTTP_LIBRARIES - The libraries needed to use llhttp | ||
# LIBLLHTTP_STATIC_INCLUDE_DIRS - The llhttp static include directories | ||
# LIBLLHTTP_STATIC_LIBRARIES - The libraries needed to use llhttp statically | ||
|
||
pkg_check_modules(LIBLLHTTP QUIET llhttp) | ||
if (NOT LIBLLHTTP_FOUND) | ||
find_path( | ||
LIBLLHTTP_INCLUDE_DIR | ||
NAMES llhttp.h | ||
) | ||
|
||
set(SAVED_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}") | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}") | ||
find_library(LIBLLHTTP_STATIC_LIBRARY NAMES llhttp) | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}") | ||
find_library(LIBLLHTTP_SHARED_LIBRARY NAMES llhttp) | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES "${SAVED_CMAKE_FIND_LIBRARY_SUFFIXES}") | ||
unset(SAVED_CMAKE_FIND_LIBRARY_SUFFIXES) | ||
|
||
if(LIBLLHTTP_SHARED_LIBRARY) | ||
set(LIBLLHTTP_LIBRARY ${LIBLLHTTP_SHARED_LIBRARY}) | ||
elseif(LIBLLHTTP_STATIC_LIBRARY) | ||
set(LIBLLHTTP_LIBRARY ${LIBLLHTTP_STATIC_LIBRARY}) | ||
endif() | ||
|
||
if(LIBLLHTTP_INCLUDE_DIR) | ||
file(STRINGS "${LIBLLHTTP_INCLUDE_DIR}/llhttp.h" LIBLLHTTP_VERSION_MAJOR REGEX "^#define[ \t]+LLHTTP_VERSION_MAJOR[ \t]+[0-9]+") | ||
file(STRINGS "${LIBLLHTTP_INCLUDE_DIR}/llhttp.h" LIBLLHTTP_VERSION_MINOR REGEX "^#define[ \t]+LLHTTP_VERSION_MINOR[ \t]+[0-9]+") | ||
string(REGEX REPLACE "[^0-9]+" "" LIBLLHTTP_VERSION_MAJOR "${LIBLLHTTP_VERSION_MAJOR}") | ||
string(REGEX REPLACE "[^0-9]+" "" LIBLLHTTP_VERSION_MINOR "${LIBLLHTTP_VERSION_MINOR}") | ||
set(LIBLLHTTP_VERSION "${LIBLLHTTP_VERSION_MAJOR}.${LIBLLHTTP_VERSION_MINOR}") | ||
unset(LIBLLHTTP_VERSION_MINOR) | ||
unset(LIBLLHTTP_VERSION_MAJOR) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( | ||
libllhttp | ||
REQUIRED_VARS LIBLLHTTP_LIBRARY LIBLLHTTP_INCLUDE_DIR | ||
VERSION_VAR LIBLLHTTP_VERSION | ||
) | ||
|
||
if(LIBLLHTTP_FOUND) | ||
if(LIBLLHTTP_SHARED_LIBRARY) | ||
set(LIBLLHTTP_LIBRARIES ${LIBLLHTTP_SHARED_LIBRARY}) | ||
else() | ||
set(LIBLLHTTP_LIBRARIES ${LIBLLHTTP_STATIC_LIBRARY}) | ||
endif() | ||
|
||
set(LIBLLHTTP_INCLUDE_DIRS ${LIBLLHTTP_INCLUDE_DIR}) | ||
|
||
set(LIBLLHTTP_STATIC_INCLUDE_DIRS ${LIBLLHTTP_INCLUDE_DIRS}) | ||
if(LIBLLHTTP_STATIC_LIBRARY) | ||
set(LIBLLHTTP_STATIC_LIBRARIES ${LIBLLHTTP_STATIC_LIBRARY}) | ||
endif() | ||
endif() | ||
|
||
mark_as_advanced(LIBLLHTTP_INCLUDE_DIR LIBLLHTTP_SHARED_LIBRARY LIBLLHTTP_STATIC_LIBRARY) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# - Try to find libev | ||
# Once done this will define | ||
# LIBSQLITE3_FOUND - System has libsqlite3 | ||
# LIBSQLITE3_INCLUDE_DIRS - The libsqlite3 include directories | ||
# LIBSQLITE3_LIBRARIES - The libraries needed to use libsqlite3 | ||
# LIBSQLITE3_STATIC_INCLUDE_DIRS - The libsqlite3 static include directories | ||
# LIBSQLITE3_STATIC_LIBRARIES - The libraries needed to use libsqlite3 statically | ||
|
||
pkg_check_modules(LIBSQLITE3 QUIET sqlite3) | ||
if (NOT LIBSQLITE3_FOUND) | ||
find_path( | ||
LIBSQLITE3_INCLUDE_DIR | ||
NAMES sqlite3.h | ||
) | ||
|
||
set(SAVED_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}") | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}") | ||
find_library(LIBSQLITE3_STATIC_LIBRARY NAMES sqlite3) | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}") | ||
find_library(LIBSQLITE3_SHARED_LIBRARY NAMES sqlite3) | ||
set(CMAKE_FIND_LIBRARY_SUFFIXES "${SAVED_CMAKE_FIND_LIBRARY_SUFFIXES}") | ||
|
||
if(LIBSQLITE3_SHARED_LIBRARY) | ||
set(LIBSQLITE3_LIBRARY ${LIBSQLITE3_SHARED_LIBRARY}) | ||
elseif(LIBSQLITE3_STATIC_LIBRARY) | ||
set(LIBSQLITE3_LIBRARY ${LIBSQLITE3_STATIC_LIBRARY}) | ||
endif() | ||
|
||
if(LIBSQLITE3_INCLUDE_DIR) | ||
file(STRINGS ${LIBSQLITE3_INCLUDE_DIR}/sqlite3.h _ver_line REGEX "^#define SQLITE_VERSION *\"[0-9]+\\.[0-9]+\\.[0-9]+\"" LIMIT_COUNT 1) | ||
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" LIBSQLITE3_VERSION "${_ver_line}") | ||
unset(_ver_line) | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( | ||
libsqlite3 | ||
REQUIRED_VARS LIBSQLITE3_LIBRARY LIBSQLITE3_INCLUDE_DIR | ||
VERSION_VAR LIBSQLITE3_VERSION | ||
) | ||
|
||
if(LIBSQLITE3_FOUND) | ||
if(LIBSQLITE3_SHARED_LIBRARY) | ||
set(LIBSQLITE3_LIBRARIES ${LIBSQLITE3_SHARED_LIBRARY}) | ||
else() | ||
set(LIBSQLITE3_LIBRARIES ${LIBSQLITE3_STATIC_LIBRARY}) | ||
endif() | ||
|
||
set(LIBSQLITE3_INCLUDE_DIRS ${LIBSQLITE3_INCLUDE_DIR}) | ||
|
||
set(LIBSQLITE3_STATIC_INCLUDE_DIRS ${LIBSQLITE3_INCLUDE_DIRS}) | ||
if(LIBSQLITE3_STATIC_LIBRARY) | ||
set(LIBSQLITE3_STATIC_LIBRARIES ${LIBSQLITE3_STATIC_LIBRARY}) | ||
endif() | ||
endif() | ||
|
||
mark_as_advanced(LIBSQLITE3_INCLUDE_DIR LIBSQLITE3_SHARED_LIBRARY LIBSQLITE3_STATIC_LIBRARY) | ||
endif() |
Oops, something went wrong.