Skip to content
Permalink
Browse files

Few more fixes for build being a sub-project

Added options WITH_MSI and WITH_UNIT_TESTS to switch build of
corresponding targets on and off.
Added transfer of named CONC_* options from parent project to the
normal names(without CONC_)
Changed all occurences of CMAKE_SOURCE/BINARY_DIR to
CC_SOURCE/BINARY_DIR (that in fact are CMAKE_CURRENT_*)
  • Loading branch information...
lawrinn committed Jun 18, 2018
1 parent 783d7ad commit 7af1e598dabae1ea26385379f1a9800bf6cc990c
Showing with 27 additions and 18 deletions.
  1. +15 −6 CMakeLists.txt
  2. +2 −2 examples/CMakeLists.txt
  3. +1 −1 mariadb_config/CMakeLists.txt
  4. +9 −9 win/packaging/CMakeLists.txt
@@ -7,6 +7,13 @@ PROJECT(mariadb-connector-c C)
# Is C/C built as subproject?
get_directory_property(IS_SUBPROJECT PARENT_DIRECTORY)

# do not inherit include directories from the parent project
SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
FOREACH(V WITH_MYSQLCOMPAT WITH_MSI WITH_SIGNCODE WITH_RTC WITH_UNIT_TESTS
WITH_EXTERNAL_ZLIB WITH_SQLITE INSTALL_LAYOUT)
SET(${V} ${${OPT}${V}})
ENDFOREACH()

SET(CC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
SET(CC_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})

@@ -19,9 +26,9 @@ MATH(EXPR MARIADB_PACKAGE_VERSION_ID "${CPACK_PACKAGE_VERSION_MAJOR} * 10000 +
${CPACK_PACKAGE_VERSION_PATCH}")
#Minimum required version is Cmake 2.8.8, since we need to build object libraries
IF(WIN32)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
ELSE()
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
ENDIF()
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
@@ -239,9 +246,11 @@ IF(NOT WIN32)
ADD_SUBDIRECTORY(mariadb_config)
ENDIF()

IF(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/unittest)
ADD_SUBDIRECTORY(unittest/mytap)
ADD_SUBDIRECTORY(unittest/libmariadb)
IF(IS_DIRECTORY ${CC_SOURCE_DIR}/unittest)
IF(WITH_UNIT_TESTS)
ADD_SUBDIRECTORY(unittest/mytap)
ADD_SUBDIRECTORY(unittest/libmariadb)
ENDIF()
ENDIF()

IF(CLIENT_DOCS)
@@ -250,7 +259,7 @@ IF(CLIENT_DOCS)
ENDIF()


IF(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
IF(WIN32 AND WITH_MSI AND CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
ADD_SUBDIRECTORY(win/packaging)
ENDIF()

@@ -1,7 +1,7 @@
SET(EXAMPLE_FILES "mysql_affected_rows"
"mysql_debug")

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${CC_SOURCE_DIR}/include)

ENABLE_TESTING()

@@ -13,6 +13,6 @@ FOREACH(EXAMPLE_FILE ${EXAMPLE_FILES})
SET(XML_EXAMPLE_FILES $XML_EXAMPLE_FILES "examples/${EXAMPLE_FILE}.c")
ADD_EXECUTABLE(${EXAMPLE_FILE} ${EXAMPLE_FILE}.c)
TARGET_LINK_LIBRARIES(${EXAMPLE_FILE} mariadbclient)
ADD_TEST(TEST_${EXAMPLE_FILE} ./${EXECUTABLE_OUTPUT_PATH}/test_output ./${EXAMPLE_FILE} ${CMAKE_SOURCE_DIR}/examples/${EXAMPLE_FILE}.out ${CMAKE_SOURCE_DIR}/examples/${EXAMPLE_FILE}.exp)
ADD_TEST(TEST_${EXAMPLE_FILE} ./${EXECUTABLE_OUTPUT_PATH}/test_output ./${EXAMPLE_FILE} ${CC_SOURCE_DIR}/examples/${EXAMPLE_FILE}.out ${CC_SOURCE_DIR}/examples/${EXAMPLE_FILE}.exp)

ENDFOREACH(EXAMPLE_FILE ${EXAMPLE_FILES})
@@ -1,4 +1,4 @@
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${CC_SOURCE_DIR}/include)

# Figure out additional libraries for use with

@@ -1,6 +1,6 @@
SET(CLIENT_LIB_DIR ${CMAKE_BINARY_DIR}/libmariadb/${CMAKE_BUILD_TYPE})
SET(CLIENT_DBG_DIR ${CMAKE_BINARY_DIR}/libmariadb/Debug)
SET(CLIENT_INC_DIR ${CMAKE_SOURCE_DIR}/include)
SET(CLIENT_LIB_DIR ${CC_BINARY_DIR}/libmariadb/${CMAKE_BUILD_TYPE})
SET(CLIENT_DBG_DIR ${CC_BINARY_DIR}/libmariadb/Debug)
SET(CLIENT_INC_DIR ${CC_SOURCE_DIR}/include)

SET(PRODUCT_NAME "MariaDB Connector C")
SET(PRODUCT_INSTALL_DIR "MariaDB")
@@ -24,18 +24,18 @@ ELSE()
SET(FOLDER "ProgramFilesFolder")
ENDIF()

SET(MARIADB_PLUGINS "${MARIADB_PLUGINS} <File Id=\"dialog.dll\" Name=\"dialog.dll\" DiskId=\"1\" Source=\"${CMAKE_BINARY_DIR}/plugins/auth/${CMAKE_BUILD_TYPE}/dialog.dll\"/>\n")
SET(MARIADB_PLUGINS "${MARIADB_PLUGINS} <File Id=\"mysql_clear_password.dll\" Name=\"mysqlclearpassword.dll\" DiskId=\"1\" Source=\"${CMAKE_BINARY_DIR}/plugins/auth/${CMAKE_BUILD_TYPE}/mysql_clear_password.dll\"/>\n")
SET(MARIADB_PLUGINS "${MARIADB_PLUGINS} <File Id=\"dialog.dll\" Name=\"dialog.dll\" DiskId=\"1\" Source=\"${CC_BINARY_DIR}/plugins/auth/${CMAKE_BUILD_TYPE}/dialog.dll\"/>\n")
SET(MARIADB_PLUGINS "${MARIADB_PLUGINS} <File Id=\"mysql_clear_password.dll\" Name=\"mysqlclearpassword.dll\" DiskId=\"1\" Source=\"${CC_BINARY_DIR}/plugins/auth/${CMAKE_BUILD_TYPE}/mysql_clear_password.dll\"/>\n")


FOREACH(src ${MARIADB_CLIENT_INCLUDES})
STRING(REPLACE "-" "_" src_id ${src})
STRING(REPLACE "mysql/" "" src_id ${src_id})
STRING(REPLACE "mysql/" "" src_name ${src})
IF(${src} MATCHES "mysql/")
SET(MARIADB_INCLUDEMYSQL_FILES "${MARIADB_INCLUDEMYSQL_FILES} <File Id=\"${src_id}\" Name=\"${src_name}\" DiskId=\"1\" Source=\"${CMAKE_SOURCE_DIR}/include/${src}\"/>\n")
SET(MARIADB_INCLUDEMYSQL_FILES "${MARIADB_INCLUDEMYSQL_FILES} <File Id=\"${src_id}\" Name=\"${src_name}\" DiskId=\"1\" Source=\"${CC_SOURCE_DIR}/include/${src}\"/>\n")
ELSE()
SET(MARIADB_INCLUDE_FILES "${MARIADB_INCLUDE_FILES} <File Id=\"${src_id}\" Name=\"${src_name}\" DiskId=\"1\" Source=\"${CMAKE_SOURCE_DIR}/include/${src}\"/>\n")
SET(MARIADB_INCLUDE_FILES "${MARIADB_INCLUDE_FILES} <File Id=\"${src_id}\" Name=\"${src_name}\" DiskId=\"1\" Source=\"${CC_SOURCE_DIR}/include/${src}\"/>\n")
ENDIF()
ENDFOREACH()

@@ -44,8 +44,8 @@ IF(NOT WIX_DIR)
SET(WIX_DIR $ENV{WIX}/bin)
ENDIF()

CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/win/packaging/mariadb-connector-c.xml.in
${CMAKE_BINARY_DIR}/win/packaging/mariadb-connector-c.xml)
CONFIGURE_FILE(${CC_SOURCE_DIR}/win/packaging/mariadb-connector-c.xml.in
${CC_BINARY_DIR}/win/packaging/mariadb-connector-c.xml)
SET(MSI_PACKAGE "mariadb-connector-c-${PRODUCT_VERSION}-${PLATFORM}.msi")

IF(WITH_SIGNCODE)

0 comments on commit 7af1e59

Please sign in to comment.
You can’t perform that action at this time.