c-test/CMakeLists.txt

55 lines
1.6 KiB
CMake
Raw Permalink Normal View History

2024-11-15 15:36:09 -05:00
# cmake_minimum_required(VERSION 3.5.0)
cmake_minimum_required(VERSION 3.10)
2024-11-04 14:44:45 -05:00
project(Test_Project VERSION 0.1.0 LANGUAGES C)
2024-11-15 15:36:09 -05:00
# Hmm, this format could be useful.
# if(WIN32)
# endif()
SET(MARIADB_INCLUDE_DIR "C:/Program Files/MariaDB/MariaDB Connector C 64-bit/include")
SET(MARIADB_LIBRARY_DIR "C:/Program Files/MariaDB/MariaDB Connector C 64-bit/lib")
SET(BINARY_NAME "Test_Project")
# MySql test
# https://dev.mysql.com/blog-archive/the-client-library-part-4-how-to-write-a-simple-mysql-client-in-c-using-cmake-and-pkg-config/
# https://stackoverflow.com/questions/72786137/how-to-compile-c-with-cmake-and-l-usr-include-mariadb-mysql-lmariadbclient
2024-11-04 14:44:45 -05:00
# Add more c files in here
2024-11-15 15:36:09 -05:00
# add_executable(${BINARY_NAME}
2024-11-04 14:47:49 -05:00
# main.c
# hello.c
# math_functions.c
# struct_test.c
# )
2024-11-15 15:36:09 -05:00
add_executable(${BINARY_NAME}
2024-11-04 14:47:49 -05:00
src/main.c
src/hello.c
src/math_functions.c
src/struct_test.c
src/pointer_test.c
src/read_file.c
2024-11-15 15:36:09 -05:00
src/mysql_test.c
2024-11-04 14:44:45 -05:00
)
# https://discourse.cmake.org/t/how-to-properly-include-header-files/4762
# Add header files in here, not sure if I did this right.
2024-11-15 15:36:09 -05:00
target_include_directories(${BINARY_NAME}
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}"
"${MARIADB_INCLUDE_DIR}"
# "${LIBMYSQLCLIENT_INCLUDE_DIRS}"
)
2024-11-04 14:44:45 -05:00
2024-11-15 15:36:09 -05:00
# https://stackoverflow.com/questions/2601798/adding-compiled-libraries-and-include-files-to-a-cmake-project
target_link_libraries(${BINARY_NAME}
"${MARIADB_LIBRARY_DIR}/libmariadb.lib"
"${MARIADB_LIBRARY_DIR}/mariadbclient.lib"
)
# add_library(Test_Project
# PUBLIC "${MARIADB_LIBRARY_DIR}/libmariadb.lib"
# "${MARIADB_LIBRARY_DIR}/mariadbclient.lib"
# )