Skip to content

Commit 6ea0ab8

Browse files
committed
cmake: Support using connector project as a cmake sub-project.
1 parent 699ed5c commit 6ea0ab8

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

CMakeLists.txt

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
6565

6666
PROJECT(MySQL_CONCPP)
6767

68-
include(version.cmake)
69-
7068
# Load cmake modules
7169

7270
include(cdk/cmake/setup.cmake)
@@ -77,6 +75,26 @@ include(dependency) # find_dependency()
7775
include(config_options) # add_config_option()
7876
include(libutils) # merge_libraries()
7977

78+
#
79+
# Detect if we are configured as stand-alone project, or sub-project.
80+
#
81+
82+
if(PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME)
83+
84+
SET(concpp_stand_alone 1)
85+
86+
else()
87+
88+
MESSAGE("Building Connector/C++ as part of ${CMAKE_PROJECT_NAME} project")
89+
SET(concpp_stand_alone 0)
90+
set(WITH_TESTS OFF)
91+
set(WITH_DOC OFF)
92+
set(WITH_HEADER_CHECKS OFF)
93+
94+
endif()
95+
96+
include(version.cmake)
97+
8098
message("Building on system: ${CMAKE_SYSTEM} (${CMAKE_SYSTEM_PROCESSOR})")
8199
message("Using cmake generator: ${CMAKE_GENERATOR}")
82100
#message("Compiler identification: ${CMAKE_CXX_COMPILER_ID}")
@@ -425,6 +443,13 @@ add_custom_command(TARGET libconcpp POST_BUILD
425443
)
426444
endif()
427445

446+
#
447+
# Stop here if this is a sub-project of a bigger project.
448+
#
449+
450+
if (NOT concpp_stand_alone)
451+
return()
452+
endif()
428453

429454
#
430455
# Install specifications

0 commit comments

Comments
 (0)