diff --git a/CMakeLists.txt b/CMakeLists.txt index 2243a23f42e..348c3b8f3a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -338,20 +338,6 @@ EndForEach(Interface) # Debugging Python-interface with CTest OPTION(ENABLE_PYTHON_DEBUG "Enable Python-interface-debugging with CTest" OFF) -# Allow to hide non-bsd compatible codes -OPTION(LICENSE_GPL_SHOGUN "Include GPL codes of Shogun (non-BSD compatible) in build" ON) -IF (LICENSE_GPL_SHOGUN) - SET(USE_GPL_SHOGUN 1) - SET(SHOGUN_GPL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/gpl) -ELSE() - SET(USE_GPL_SHOGUN 0) -ENDIF() - -# SVMLight -OPTION(USE_SVMLIGHT "SVMLight" ON) -IF(USE_SVMLIGHT AND NOT USE_GPL_SHOGUN) - MESSAGE(FATAL_ERROR "Can only use SVMLight when GPL codes are included") -ENDIF() SET(SVMLightWarning "\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") SET(SVMLightWarning "${SVMLightWarning}\nWARNING: SHOGUN is built using SVMlight which was written") SET(SVMLightWarning "${SVMLightWarning}\nby Thorsten Joachims and uses a different non GPL compatible license.") diff --git a/src/shogun/CMakeLists.txt b/src/shogun/CMakeLists.txt index 75fb1d91afc..fc5be3f9292 100644 --- a/src/shogun/CMakeLists.txt +++ b/src/shogun/CMakeLists.txt @@ -29,6 +29,26 @@ if (MSVC AND (BUILD_EXAMPLES OR BUILD_META_EXAMPLES)) CACHE BOOL "Build libshogun static library" FORCE) endif() +# Allow to hide non-bsd compatible codes +OPTION(LICENSE_GPL_SHOGUN "Include GPL codes of Shogun (non-BSD compatible) in build" ON) +IF (LICENSE_GPL_SHOGUN) + SET(USE_GPL_SHOGUN 1) + SET(SHOGUN_GPL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/src/gpl) + + FILE(GLOB_RECURSE GPL_LIBSHOGUN_SRC *.${EXT_SRC_CPP} *.${EXT_SRC_C}) + FILE(GLOB_RECURSE GPL_LIBSHOGUN_HEADERS *.${EXT_SRC_HEADER}) + LIST(APPEND LIBSHOGUN_SRC ${GPL_LIBSHOGUN_SRC}) + LIST(APPEND LIBSHOGUN_HEADERS ${GPL_LIBSHOGUN_HEADERS}) + INCLUDE_DIRECTORIES(${SHOGUN_GPL_INCLUDE_DIR}) +ELSE() + SET(USE_GPL_SHOGUN 0) +ENDIF() + +OPTION(USE_SVMLIGHT "SVMLight" ON) +IF(USE_SVMLIGHT AND NOT USE_GPL_SHOGUN) + MESSAGE(FATAL_ERROR "Can only use SVMLight when GPL codes are included") +ENDIF() + # add target to compile the libshogun sources add_library(libshogun OBJECT ${LIBSHOGUN_SRC} ${LIBSHOGUN_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/lib/config.h) set_property(TARGET libshogun PROPERTY POSITION_INDEPENDENT_CODE TRUE)