- Fix version bump missed in 0.9.1 release
- Include LANGUAGES in project()
- Make everything more consice
---
CMakeLists.txt | 99 ++++++++----------------------------------
gawkext/CMakeLists.txt | 22 ++++++++++
2 files changed, 40 insertions(+), 81 deletions(-)
create mode 100644 gawkext/CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba51acb..a3a3d31 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,64 +1,20 @@
cmake_minimum_required(VERSION 3.0)
-project("pnc" VERSION 0.9.0)
+project("pnc" VERSION 0.9.2 LANGUAGES C CXX)
-include(CheckIncludeFiles)
-
-find_library(
- LIBPHONENUMBER
- phonenumber
- PATHS
- /usr/local/lib
-)
-
-find_library(
- LIBGEOCODING
- geocoding
- PATHS
- /usr/local/lib
-)
-
-find_library(
- LIBICUUC
- icuuc
- PATHS
- /usr/local/lib
-)
-
-include_directories(
- BEFORE
- SYSTEM
- /usr/local/include
-)
+find_library(LIBPHONENUMBER phonenumber PATHS /usr/local/lib REQUIRED)
+find_library(LIBGEOCODING geocoding PATHS /usr/local/lib REQUIRED)
+find_library(LIBICUUC icuuc PATHS /usr/local/lib REQUIRED)
-check_include_files(
- "stdio.h;errno.h;stdio.h;stddef.h;string.h;stdlib.h;sys/types.h;sys/stat.h;gawkapi.h"
- HAVE_GAWK_H
-)
+include_directories(BEFORE SYSTEM /usr/local/include)
add_compile_definitions(VERSION=\"${PROJECT_VERSION}\")
-if(${LIBPHONENUMBER-NOTFOUND})
- message(FATAL_ERROR "could not find prerequisite: libphonenumber")
-endif(${LIBPHONENUMBER-NOTFOUND})
-
-if(${LIBGEOCODING-NOTFOUND})
- message(FATAL_ERROR "could not find prerequisite: libgeocoding")
-endif(${LIBGEOCODING-NOTFOUND})
-
-if(${LIBICUUC-NOTFOUND})
- message(FATAL_ERROR "could not find prerequisite: libicuuc")
-endif(${LIBICUUC-NOTFOUND})
-
-add_executable(
- pnc
+add_executable(pnc
src/pnc.cc
)
-target_link_libraries(
- pnc
- ${LIBICUUC}
- ${LIBPHONENUMBER}
- ${LIBGEOCODING}
+target_link_libraries(pnc
+ ${LIBICUUC} ${LIBPHONENUMBER} ${LIBGEOCODING}
)
enable_testing()
@@ -78,33 +34,14 @@ install(
DESTINATION share/man/man1
)
-if( HAVE_GAWK_H )
- add_library(
- gawkpn
- SHARED
- gawkext/gawkpnwrap.c
- gawkext/gawkpnimpl.cc
- )
-
- set_target_properties(gawkpn PROPERTIES PREFIX "")
-
- target_link_libraries(
- gawkpn
- ${LIBICUUC}
- ${LIBPHONENUMBER}
- ${LIBGEOCODING}
- )
-
- execute_process(
- COMMAND
- gawk "BEGIN {print ENVIRON[\"AWKLIBPATH\"]}"
- OUTPUT_VARIABLE
- AWKLIBPATH
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
+include(CheckIncludeFiles)
+check_include_files(
+ "stdio.h;errno.h;stdio.h;stddef.h;string.h;stdlib.h;sys/types.h;sys/stat.h;gawkapi.h"
+ HAVE_GAWK_H
+)
- install(
- TARGETS gawkpn
- DESTINATION ${AWKLIBPATH}
- )
-endif( HAVE_GAWK_H )
+if(HAVE_GAWK_H)
+ add_subdirectory(gawkext)
+else()
+ message(WARNING "Excluding gawk plugin as needed headers (namely gawkapi.h) were not found!")
+endif(HAVE_GAWK_H)
diff --git a/gawkext/CMakeLists.txt b/gawkext/CMakeLists.txt
new file mode 100644
index 0000000..178f9d0
--- /dev/null
+++ b/gawkext/CMakeLists.txt
@@ -0,0 +1,22 @@
+add_library(gawkpn
+ SHARED
+ gawkext/gawkpnwrap.c gawkext/gawkpnimpl.cc
+)
+
+set_target_properties(gawkpn PROPERTIES PREFIX "")
+
+target_link_libraries(gawkpn
+ ${LIBICUUC} ${LIBPHONENUMBER} ${LIBGEOCODING}
+)
+
+execute_process(
+ COMMAND
+ gawk "BEGIN {print ENVIRON[\"AWKLIBPATH\"]}"
+ OUTPUT_VARIABLE
+ AWKLIBPATH
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+install(
+ TARGETS gawkpn
+ DESTINATION ${AWKLIBPATH}
+)
--
2.38.1