[cmake] only require a CXX compiler when tests are build
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
This commit is contained in:
committed by
Yann Collet
parent
2d224dc745
commit
769723aee2
@@ -37,7 +37,6 @@ project(zstd
|
||||
VERSION "${ZSTD_FULL_VERSION}"
|
||||
LANGUAGES C # Main library is in C
|
||||
ASM # And ASM
|
||||
CXX # Testing contributed code also utilizes CXX
|
||||
)
|
||||
|
||||
message(STATUS "ZSTD VERSION: ${zstd_VERSION}")
|
||||
@@ -54,12 +53,6 @@ endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add extra compilation flags
|
||||
#-----------------------------------------------------------------------------
|
||||
include(AddZstdCompilationFlags)
|
||||
ADD_ZSTD_COMPILATION_FLAGS()
|
||||
|
||||
# Always hide XXHash symbols
|
||||
add_definitions(-DXXH_NAMESPACE=ZSTD_)
|
||||
|
||||
@@ -123,6 +116,19 @@ if (MSVC)
|
||||
option(ZSTD_USE_STATIC_RUNTIME "LINK TO STATIC RUN-TIME LIBRARIES" OFF)
|
||||
endif ()
|
||||
|
||||
# Enable C++ support for testing.
|
||||
set(ZSTD_ENABLE_CXX ${ZSTD_BUILD_TESTS})
|
||||
|
||||
if(ZSTD_ENABLE_CXX)
|
||||
enable_language(CXX)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add extra compilation flags
|
||||
#-----------------------------------------------------------------------------
|
||||
include(AddZstdCompilationFlags)
|
||||
ADD_ZSTD_COMPILATION_FLAGS(ON ZSTD_ENABLE_CXX ON) # C CXX LD
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# External dependencies
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user