c-test/CMakeLists.txt

55 lines
1.6 KiB
CMake

# cmake_minimum_required(VERSION 3.5.0)
cmake_minimum_required(VERSION 3.10)
project(Test_Project VERSION 0.1.0 LANGUAGES C)
# 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
# Add more c files in here
# add_executable(${BINARY_NAME}
# main.c
# hello.c
# math_functions.c
# struct_test.c
# )
add_executable(${BINARY_NAME}
src/main.c
src/hello.c
src/math_functions.c
src/struct_test.c
src/pointer_test.c
src/read_file.c
src/mysql_test.c
)
# https://discourse.cmake.org/t/how-to-properly-include-header-files/4762
# Add header files in here, not sure if I did this right.
target_include_directories(${BINARY_NAME}
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}"
"${MARIADB_INCLUDE_DIR}"
# "${LIBMYSQLCLIENT_INCLUDE_DIRS}"
)
# 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"
# )