@@ -403,40 +403,13 @@ foreach(i RANGE ${length})
403403 set(CONFIG_OUT "${CONFIG_OUT}${line} " )
404404endforeach()
405405
406- set(GECODE_BUILD_DEFINES "/* Disable autolink because all dependencies are handled by CMake. */\n " )
407- foreach(component SUPPORT KERNEL)
408- string (APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_${component} \n " )
409- endforeach()
410- if(GECODE_ENABLE_SEARCH)
411- string (APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_SEARCH\n " )
412- endif()
413- if(GECODE_ENABLE_INT_VARS)
414- string (APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_INT\n " )
415- endif()
416- if(GECODE_ENABLE_SET_VARS)
417- string (APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_SET\n " )
418- endif()
419- if(GECODE_ENABLE_FLOAT_VARS)
420- string (APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_FLOAT\n " )
421- endif()
422- if(GECODE_ENABLE_MINIMODEL)
423- string (APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_MINIMODEL\n " )
424- endif()
425- if(GECODE_ENABLE_FLATZINC)
426- string (APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_FLATZINC\n " )
427- endif()
428- if(GECODE_ENABLE_DRIVER)
429- string (APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_DRIVER\n " )
430- endif()
431- if(GECODE_BUILD_GIST_TARGET)
432- string (APPEND GECODE_BUILD_DEFINES "#define GECODE_BUILD_GIST\n " )
433- endif()
434-
435406file(WRITE ${GECODE_BINARY_DIR} /gecode/support/config.hpp
436407"/* gecode/support/config.hpp. Generated from config.hpp.in by configure. */
437408/* gecode/support/config.hpp.in. Generated from configure.ac by autoheader. */
438409
439- ${GECODE_BUILD_DEFINES}
410+ /* Disable MSVC pragma-based auto-linking: CMake wires dependencies explicitly. */
411+ #define GECODE_NO_AUTOLINK 1
412+
440413${CONFIG_OUT} " )
441414
442415# ---------------------------------------------------------------------------
@@ -567,6 +540,7 @@ function(add_gecode_component_library lib)
567540
568541 if(GECODE_BUILD_SHARED)
569542 add_library(gecode${lib} _shared SHARED ${sources} )
543+ target_compile_definitions(gecode${lib} _shared PRIVATE GECODE_BUILD_${libupper} )
570544 target_include_directories(gecode${lib} _shared
571545 PUBLIC
572546 $<BUILD_INTERFACE :${CMAKE_CURRENT_BINARY_DIR} >
@@ -585,6 +559,7 @@ function(add_gecode_component_library lib)
585559
586560 if(GECODE_BUILD_STATIC)
587561 add_library(gecode${lib} _static STATIC ${sources} )
562+ target_compile_definitions(gecode${lib} _static PRIVATE GECODE_BUILD_${libupper} )
588563 target_include_directories(gecode${lib} _static
589564 PUBLIC
590565 $<BUILD_INTERFACE :${CMAKE_CURRENT_BINARY_DIR} >
0 commit comments