-
Notifications
You must be signed in to change notification settings - Fork 120
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
Replace ant build with cmake #14
Changes from 27 commits
a853310
774ea16
b472300
e3000f6
80a9fdb
d919ea1
c244c28
e64b7cf
5b5ec13
a71f936
e5f8af1
704a80f
6c1e0b6
472d97b
5b81898
0504bc5
4ffba69
c3146a5
73f7333
426660e
f3edfc4
48c597b
08d6176
dc7dc14
b3bec51
7995db2
8dc8120
4745721
c4f1b3d
6862c5e
f133149
d08e392
06875bd
b9d9b0e
cd4a455
d5b5c38
e0b4e4d
ac90504
6ae3567
d0c6cae
b971dd0
a261ca7
84d3b60
178598b
2027010
c8eb659
c36fea0
bb9ab5f
e2c3533
05e107a
0e5aee9
13a1eed
af0134a
3775ffa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
include(src/cmake/projectVersionDetails.cmake) | ||
project(log4cxx VERSION ${log4cxx_VER} LANGUAGES CXX) | ||
include(CTest) | ||
|
||
# FindAPR and FindAPR-util are not provided by APR and APR-Util so source them locally | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/src/cmake") | ||
|
||
# Find Apache Runtime | ||
find_package(APR QUIET) | ||
# If APR find module sets the cache, the following will do nothing | ||
find_path(APR_INCLUDE_DIR apr.h PATH_SUFFIXES apr-1) | ||
find_library(APR_LIBRARIES NAMES libapr-1 apr-1) | ||
|
||
# Find Apache Runtime Utilities | ||
find_package(APR-Util QUIET) | ||
# If APR-UTIL find module sets the cache, the following will do nothing | ||
find_path(APR_UTIL_INCLUDE_DIR apu.h PATH_SUFFIXES apr-1) | ||
find_library(APR_UTIL_LIBRARIES NAMES libaprutil-1 aprutil-1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this use FindPkgConfig and pkg_check_modules on Unix systems instead of find_package? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DO APR and APR-UTIL provide support pkg-config? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I'm aware they do; I just tried this on Debian 10(buster), and it works properly though. I'm not sure what is best. Maybe this is better as a fallback if pkg_check_modules fails? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The best practices from Professional CMake book include the statement: I am inclined to stick with find_package if that is OK. |
||
|
||
# Building | ||
add_subdirectory(src) | ||
|
||
## Installing | ||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src/main/include/log4cxx | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
FILES_MATCHING PATTERN "*.h" | ||
) | ||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/main/include/log4cxx | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
FILES_MATCHING PATTERN "*.h" | ||
) | ||
|
||
install(TARGETS log4cxx EXPORT log4cxxTargets | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) | ||
stephen-webb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
IF(WIN32 AND LOG4CXX_INSTALL_PDB) | ||
INSTALL(FILES $<TARGET_PDB_FILE:log4cxx> | ||
DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
CONFIGURATIONS RelWithDebInfo Debug | ||
) | ||
ENDIF() | ||
|
||
# create export file which can be imported by other cmake projects | ||
install(EXPORT log4cxxTargets | ||
FILE log4cxx-targets.cmake | ||
NAMESPACE log4cxx:: | ||
DESTINATION share/cmake/log4cxx | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to have a lower version of cmake? What I generally do is to target the version of CMake that is in the oldstable version of Debian(as of right now, Debian 9(stretch) has cmake 3.7). This is not a requirement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I may have used some cmake that requires 3.13. It was 6 months ago so I cannot recall exact details.
I have been trying to follow best practices in Professional CMake (4th Edition)