
file(GLOB_RECURSE termq_SOURCES "*.cpp")
file(GLOB_RECURSE termq_HEADERS "*.h")
#message("TERMQ SOURCES:" ${termq_SOURCES})

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

# Add all sources except main.cpp
# TODO include all, then remove main.cpp
add_library(TERMQ_LIB
    directions.h
    game.h
    gameover.h
    menu.h
    entities/Actor.cpp
    entities/Actor.h
    entities/Coin.cpp
    entities/Coin.h
    entities/Enemy.cpp
    entities/Enemy.h
    entities/Entity.cpp
    entities/Entity.h
    entities/Item.cpp
    entities/Item.h
    entities/Player.cpp
    entities/Player.h
    global/difficulty-levels.h
    global/Global.cpp
    global/Global.h
    windows/DiagWindow.cpp
    windows/DiagWindow.h
    windows/MenuWindow.cpp
    windows/MenuWindow.h
    windows/StatusBar.cpp
    windows/StatusBar.h
    windows/Window.cpp
    windows/Window.h
    world/Cell.cpp
    world/Cell.h
    world/Map.cpp
    world/Map.h
    world/World.cpp
    world/World.h
)

add_executable(termq ${termq_SOURCES})
target_link_libraries(termq PRIVATE ${NCURSES_LIBRARIES})


set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

# Assign all source files recursively to `lib_src'
file(GLOB_RECURSE lib_src *.cpp *.h)

# Except main and cmake
list(REMOVE_ITEM lib_src main.cpp)

# Print lib_src list for debugging
message("Adding library source files:")
foreach(source_file ${lib_src})
    #message("\t" ${source_file})
endforeach(source_file)

# Finally add them
add_library(TERMQ_LIB
    ${lib_src}
)

# Add library target `termq'
add_library(termq ${lib_src})
target_link_libraries(termq PRIVATE ${NCURSES_LIBRARIES})


Build sources for target lib, not exe
Build sources for target lib, not exe

* Red commit: rather than listing every source file to include in lib,
  include them all recursively, then remove main entry point.
* While here, add (commented-out) debug println listing files in lib
  src.
