Skip to content

Commit

Permalink
Don't include headers in CMakeLists.txt after all
Browse files Browse the repository at this point in the history
The headers were added because Microsoft Visual Studio's "Solution" view
doesn't show the headers.  However, VS' built-in CMake handling doesn't use the
solution view and is based on folders (much like CMake itself).  There is no
recommendation from the CMake side on how to handle this problem with CMake's
built-in generators for Visual Studio.

Following the VS documentation and the instructions added in #999, one can get
(at least) decent VS support with IntelliSense working.  This doesn't require
keeping the headers in the CMakeLists, so remove them for more idiomatic CMake
code.

This reverts part of commit 6e38a15.
See #1005.
  • Loading branch information
lmoureaux committed May 10, 2022
1 parent 3396735 commit 4202588
Show file tree
Hide file tree
Showing 15 changed files with 4 additions and 260 deletions.
3 changes: 0 additions & 3 deletions ai/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ add_library(
ai
STATIC
aitraits.cpp
aitraits.h
classic
difficulty.cpp
difficulty.h
handicaps.cpp
handicaps.h
)

target_include_directories(ai PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
1 change: 0 additions & 1 deletion ai/classic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ add_library(
ai_classic
STATIC
classicai.cpp
classicai.h
)

target_include_directories(ai_classic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
20 changes: 0 additions & 20 deletions ai/default/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,25 @@ add_library(
ai_default
STATIC
aiair.cpp
aiair.h
aidata.cpp
aidata.h
aidiplomat.cpp
aidiplomat.h
aiferry.cpp
aiferry.h
aiguard.cpp
aiguard.h
aihand.cpp
aihand.h
aihunt.cpp
aihunt.h
ailog.cpp
ailog.h
aiparatrooper.cpp
aiparatrooper.h
aiplayer.cpp
aiplayer.h
aisettler.cpp
aisettler.h
aitech.cpp
aitech.h
aitools.cpp
aitools.h
aiunit.cpp
aiunit.h
daiactions.cpp
daiactions.h
daicity.cpp
daicity.h
daidiplomacy.cpp
daidiplomacy.h
daidomestic.cpp
daidomestic.h
daieffects.cpp
daieffects.h
daimilitary.cpp
daimilitary.h
)

target_include_directories(ai_default PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
45 changes: 3 additions & 42 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,94 +31,55 @@ target_include_directories(client_gen PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(client_gen PUBLIC common)

if (AUDIO_SDL)
set(FREECIV_AUDIO audio_sdl.cpp audio_sdl.h)
set(FREECIV_AUDIO audio_sdl.cpp)
endif()

add_library(
client
STATIC
attribute.cpp
attribute.h
audio_none.cpp
audio_none.h
audio.cpp
audio.h
chatline_common.cpp
chatline_common.h
citybar.cpp
citybar.h
citydlg_common.cpp
citydlg_common.h
cityrepdata.cpp
cityrepdata.h
client_main.cpp
client_main.h
climap.cpp
climap.h
climisc.cpp
climisc.h
clinet.cpp
clinet.h
colors_common.cpp
colors_common.h
connectdlg_common.cpp
connectdlg_common.h
control.cpp
control.h
editor.cpp
editor.h
global_worklist.cpp
global_worklist.h
goto.cpp
goto.h
governor.cpp
governor.h
layer_background.cpp
layer_background.h
layer_base_flags.cpp
layer_base_flags.h
layer_darkness.cpp
layer_darkness.h
layer_special.cpp
layer_special.h
layer_terrain.cpp
layer_terrain.h
layer.cpp
layer.h
luaconsole_common.cpp
luaconsole_common.h
mapctrl_common.cpp
mapctrl_common.h
mapview_common.cpp
mapview_common.h
messagewin_common.cpp
messagewin_common.h
music.cpp
music.h
options.cpp
options.h
overview_common.cpp
overview_common.h
plrdlg_common.cpp
plrdlg_common.h
repodlgs_common.cpp
repodlgs_common.h
reqtree.cpp
reqtree.h
text.cpp
text.h
themes_common.cpp
themes_common.h
tilespec.cpp
tilespec.h
update_queue.cpp
update_queue.h
voteinfo.cpp
voteinfo.h
${FREECIV_AUDIO}
)
if(NOT EMSCRIPTEN)
target_sources(client PRIVATE servers.cpp servers.h)
target_sources(client PRIVATE servers.cpp)
endif()

target_include_directories(client PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Expand All @@ -142,7 +103,7 @@ add_compile_definitions(NOMINMAX)

if(FREECIV_ENABLE_CLIENT)
add_subdirectory(gui-qt)
add_executable(freeciv21-client ${GUI_TYPE} packhand.cpp packhand.h) # packhand.c depends on gui-qt
add_executable(freeciv21-client ${GUI_TYPE} packhand.cpp) # packhand.c depends on gui-qt
if(EMSCRIPTEN)
target_link_options(freeciv21-client PRIVATE
-sASSERTIONS=1
Expand Down
51 changes: 0 additions & 51 deletions client/gui-qt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,106 +5,55 @@ add_library(
gui-qt
STATIC
canvas.cpp
canvas.h
chatline.cpp
chatline.h
citydlg.cpp
citydlg.h
cityrep.cpp
cityrep.h
civstatus.cpp
civstatus.h
colors.cpp
colors.h
connectdlg.cpp
connectdlg.h
dialogs.cpp
dialogs.h
diplodlg.cpp
diplodlg.h
economyreport.cpp
economyreport.h
endgamereport.cpp
endgamereport.h
fc_client.cpp
fc_client.h
fonts.cpp
fonts.h
gotodlg.cpp
gotodlg.h
gui_main.cpp
gui_main.h
helpdlg.cpp
helpdlg.h
hudwidget.cpp
hudwidget.h
icons.cpp
icons.h
idlecallback.cpp
idlecallback.h
listener.h
luaconsole.cpp
luaconsole.h
mapctrl.cpp
mapctrl.h
mapview.cpp
mapview.h
menu.cpp
menu.h
messageoptions.cpp
messageoptions.h
messagewin.cpp
messagewin.h
minimap.cpp
minimap.h
notifyreport.cpp
notifyreport.h
optiondlg.cpp
optiondlg.h
page_game.cpp
page_game.h
page_load.cpp
page_load.h
page_main.cpp
page_main.h
page_network.cpp
page_network.h
page_pregame.cpp
page_pregame.h
page_scenario.cpp
page_scenario.h
plrdlg.cpp
plrdlg.h
pregameoptions.cpp
pregameoptions.h
qtg_cxxside.h
ratesdlg.cpp
ratesdlg.h
sciencedlg.cpp
sciencedlg.h
shortcuts.cpp
shortcuts.h
spaceshipdlg.cpp
spaceshipdlg.h
sprite.cpp
sprite.h
themes.cpp
tileset_debugger.cpp
tileset_debugger.h
tooltips.cpp
tooltips.h
top_bar.cpp
top_bar.h
tradecalculation.cpp
tradecalculation.h
unitreport.cpp
unitreport.h
unitselect.cpp
unitselect.h
voteinfo_bar.cpp
voteinfo_bar.h
widgetdecorations.cpp
widgetdecorations.h
)

target_include_directories(gui-qt PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
2 changes: 0 additions & 2 deletions client/luascript/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ add_library(
luascript
STATIC
api_client_base.cpp
api_client_base.h
script_client.cpp
script_client.h
# Generated
${CMAKE_CURRENT_BINARY_DIR}/tolua_client_gen.cpp
${CMAKE_CURRENT_BINARY_DIR}/tolua_client_gen.h
Expand Down
Loading

0 comments on commit 4202588

Please sign in to comment.