diff --git a/CMakeLists.txt b/CMakeLists.txt index 481294f..d0d6077 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,11 +5,12 @@ project(puzzles include(cmake/setup.cmake) -add_library(common +add_library(core_obj OBJECT combi.c divvy.c drawing.c dsf.c findloop.c grid.c latin.c - laydomino.c loopgen.c malloc.c matching.c midend.c misc.c penrose.c hat.c - ps.c random.c sort.c tdq.c tree234.c version.c - ${platform_common_sources}) + laydomino.c loopgen.c malloc.c matching.c midend.c misc.c penrose.c + ps.c random.c sort.c tdq.c tree234.c version.c ${platform_common_sources}) +add_library(core $) +add_library(common $ hat.c) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/auxiliary/CMakeLists.txt b/auxiliary/CMakeLists.txt index f475812..b9c1067 100644 --- a/auxiliary/CMakeLists.txt +++ b/auxiliary/CMakeLists.txt @@ -1,6 +1,6 @@ cliprogram(combi-test combi-test.c) cliprogram(divvy-test divvy-test.c) -cliprogram(hatgen hatgen.c COMPILE_DEFINITIONS TEST_HAT) +cliprogram(hatgen hatgen.c CORE_LIB COMPILE_DEFINITIONS TEST_HAT) cliprogram(hat-test hat-test.c) cliprogram(latin-test latin-test.c) cliprogram(matching matching.c) diff --git a/cmake/setup.cmake b/cmake/setup.cmake index 3c91285..3b73739 100644 --- a/cmake/setup.cmake +++ b/cmake/setup.cmake @@ -148,12 +148,18 @@ endfunction() # a command-line helper tool. function(cliprogram NAME) cmake_parse_arguments(OPT - "" "" "COMPILE_DEFINITIONS" ${ARGN}) + "CORE_LIB" "" "COMPILE_DEFINITIONS" ${ARGN}) + + if(OPT_CORE_LIB) + set(lib core) + else() + set(lib common) + endif() if(build_cli_programs) add_executable(${NAME} ${CMAKE_SOURCE_DIR}/nullfe.c ${OPT_UNPARSED_ARGUMENTS}) - target_link_libraries(${NAME} common ${platform_libs}) + target_link_libraries(${NAME} ${lib} ${platform_libs}) if(OPT_COMPILE_DEFINITIONS) target_compile_definitions(${NAME} PRIVATE ${OPT_COMPILE_DEFINITIONS}) endif()