drogonCMS-cmake #27

Merged
sharpetronics merged 3 commits from drogonCMS-cmake into master 2024-02-23 18:46:28 -05:00
Showing only changes of commit 43c9cbb39b - Show all commits

View File

@ -54,6 +54,9 @@ project(
VERSION 1.0.0
)
# Adding something we can run - Output name matches target name
add_executable(DrogonCMS src/base.c)
#===============================================================================
# Setting compilation flags for various compilers and build types:
#===============================================================================
@ -112,9 +115,8 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif()
# Find packages go here.
# Find PkgConfig.
find_package(PkgConfig REQUIRED)
find_package(PostgreSQL REQUIRED)
pkg_check_modules(GTK4 REQUIRED gtk4>=4.0)
message("GTK4 include dir: ${GTK4_INCLUDE_DIRS}")
@ -128,23 +130,33 @@ message("ADW other Cflags: ${ADW_CFLAGS_OTHER}")
#pkg_check_modules(SSL REQUIRED openssl>=3.1.2)
#message("SSL libraries: ${SSL_LIBRARY_DIRS}")
#pkg_check_modules(SSL REQUIRED zlib>=1.3)
# Make use of PostgreSQL if FOUND, else use SQLite3
find_package (PostgreSQL)
if (PostgreSQL_FOUND)
message("POSTGRESQL include dir: ${PostgreSQL_INCLUDE_DIRS}")
message("POSTGRESQL libraries: ${PostgreSQL_LIBRARIES}")
include_directories(${PostgreSQL_INCLUDE_DIRS} ${PostgreSQL_SERVER_INCLUDE_DIRS})
target_link_libraries (${PROJECT_NAME} PUBLIC ${PostgreSQL_LIBRARIES})
#pkg_check_modules(SQLite3 REQUIRED sqlite3>=3.43.1)
elseif (SQLITE3_FOUND)
find_package (SQLite3)
message("SQLITE3 include dir: ${SQLITE3_INCLUDE_DIRS}")
message("SQLITE3 libraries: ${SQLITE3_LIBRARIES}")
include_directories(${SQLITE3_INCLUDE_DIRS})
target_link_libraries (${PROJECT_NAME} PUBLIC ${SQLITE3_LIBRARIES})
endif (PostgreSQL_FOUND)
# Setup CMake to use GTK+, tell the compiler where to look for headers
# and to the linker where to look for libraries
include_directories(${GTK4_INCLUDE_DIRS} ${ADW_INCLUDE_DIRS} ${PostgreSQL_INCLUDE_DIRS} ${PostgreSQL_SERVER_INCLUDE_DIRS})
include_directories(${GTK4_INCLUDE_DIRS} ${ADW_INCLUDE_DIRS})
link_directories(${GTK4_LIBRARY_DIRS} ${ADW_LIBRARY_DIRS})
add_definitions(${GTK4_CFLAGS_OTHER} ${ADW_CFLAGS_OTHER})
# Adding something we can run - Output name matches target name
add_executable(DrogonCMS src/base.c )
#add_executable(PG_Store vendors/postgresql-db/main.cc)
# Include drogon source code locally
add_subdirectory(vendors/api-server/)
add_subdirectory(vendors/simple-reverse-proxy/)
#add_subdirectory(vendors/cmake/)
# This is a "default" library, and will match the *** variable setting.
# Other common choices are STATIC, SHARED, and MODULE
@ -156,16 +168,11 @@ add_subdirectory(vendors/simple-reverse-proxy/)
# Make sure you link your targets with this command. It can also link libraries and
# even flags, so linking a target that does not exist will not give a configure-time error.
target_include_directories(${PROJECT_NAME} PUBLIC ${GTK4_LIBRARIES} ${ADW_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PRIVATE ${GTK4_LIBRARIES} ${ADW_LIBRARIES} PostgreSQL::PostgreSQL)
target_link_libraries(${PROJECT_NAME} PRIVATE ${GTK4_LIBRARIES} ${ADW_LIBRARIES})
# Target Compile Options
target_compile_options(${PROJECT_NAME} PRIVATE ${WARNING_LEVELS_GCC} $<$<CONFIG:DEBUG>:${WARNING_LEVELS_GCC_DEBUG}>)
# This part is so the Modern CMake book can verify this example builds. For your code,
# you'll probably want tests too
enable_testing()
#add_test(NAME MyExample COMMAND MyExample)
#===============================================================================
# Package generation:
#===============================================================================