From 7abf7c57482da1d2df8bb47036b83af444bad68c Mon Sep 17 00:00:00 2001
From: James Turner <zakalawe@mac.com>
Date: Sun, 26 Jun 2011 07:49:37 +0100
Subject: [PATCH] CMake header support for XCode/Visual Studio

---
 CMakeModules/FlightGearComponent.cmake |  2 +-
 src/AIModel/CMakeLists.txt             | 25 +++++++++++++++++++++++--
 src/Aircraft/CMakeLists.txt            | 10 ++++++++--
 src/Airports/CMakeLists.txt            | 22 +++++++++++++++++++---
 src/Autopilot/CMakeLists.txt           | 18 +++++++++++++++++-
 src/Cockpit/CMakeLists.txt             |  9 ++++++++-
 src/Environment/CMakeLists.txt         | 23 +++++++++++++++++++++--
 src/GUI/CMakeLists.txt                 | 17 +++++++++++++++--
 src/Main/CMakeLists.txt                | 25 +++++++++++++++++++++++--
 src/Navaids/CMakeLists.txt             | 18 ++++++++++++++++--
 10 files changed, 151 insertions(+), 18 deletions(-)

diff --git a/CMakeModules/FlightGearComponent.cmake b/CMakeModules/FlightGearComponent.cmake
index 7de5743b6..2b0daa93c 100644
--- a/CMakeModules/FlightGearComponent.cmake
+++ b/CMakeModules/FlightGearComponent.cmake
@@ -2,7 +2,7 @@
 macro(flightgear_component name sources)
 
 	set(libName "fg${name}")
-	add_library(${libName} STATIC ${sources} )
+	add_library(${libName} STATIC ${sources} ${ARGV2})
 
 	set_property(GLOBAL APPEND PROPERTY FG_LIBS ${libName})
     
diff --git a/src/AIModel/CMakeLists.txt b/src/AIModel/CMakeLists.txt
index 8cc8f74d2..08105fee0 100644
--- a/src/AIModel/CMakeLists.txt
+++ b/src/AIModel/CMakeLists.txt
@@ -23,6 +23,27 @@ set(SOURCES
 	performancedb.cxx
 	submodel.cxx
 	)
-	
-flightgear_component(AIModel "${SOURCES}")
+
+set(HEADERS
+	AIAircraft.hxx
+	AIBallistic.hxx
+	AIBase.hxx
+	AICarrier.hxx
+	AIEscort.hxx
+	AIFlightPlan.hxx
+	AIGroundVehicle.hxx
+	AIManager.hxx
+	AIMultiplayer.hxx
+	AIShip.hxx
+	AIStatic.hxx
+	AIStorm.hxx
+	AITanker.hxx
+	AIThermal.hxx
+	AIWingman.hxx
+	performancedata.hxx
+	performancedb.hxx
+	submodel.hxx
+	)
+    		
+flightgear_component(AIModel "${SOURCES}" "${HEADERS}")
 	
\ No newline at end of file
diff --git a/src/Aircraft/CMakeLists.txt b/src/Aircraft/CMakeLists.txt
index da519fb27..974d66559 100644
--- a/src/Aircraft/CMakeLists.txt
+++ b/src/Aircraft/CMakeLists.txt
@@ -4,5 +4,11 @@ set(SOURCES
 	controls.cxx
 	replay.cxx
 	)
-	
-flightgear_component(Aircraft "${SOURCES}")
\ No newline at end of file
+
+set(HEADERS
+	controls.hxx
+	replay.hxx
+	)
+
+
+flightgear_component(Aircraft "${SOURCES}" "${HEADERS}")
\ No newline at end of file
diff --git a/src/Airports/CMakeLists.txt b/src/Airports/CMakeLists.txt
index 5be24c7df..43f2a999f 100644
--- a/src/Airports/CMakeLists.txt
+++ b/src/Airports/CMakeLists.txt
@@ -2,7 +2,6 @@ include(FlightGearComponent)
 
 set(SOURCES
 	apt_loader.cxx
-	calc_loc.cxx
 	dynamicloader.cxx
 	dynamics.cxx
 	gnnode.cxx
@@ -17,5 +16,22 @@ set(SOURCES
 	simple.cxx
 	xmlloader.cxx
 	)
-	
-flightgear_component(Airports "${SOURCES}")
\ No newline at end of file
+
+set(HEADERS
+	apt_loader.hxx
+	dynamicloader.hxx
+	dynamics.hxx
+	gnnode.hxx
+	groundnetwork.hxx
+	parking.hxx
+	pavement.hxx
+	runwaybase.hxx
+	runwayprefloader.hxx
+	runwayprefs.hxx
+	runways.hxx
+	sidstar.hxx
+	simple.hxx
+	xmlloader.hxx
+	)
+    		
+flightgear_component(Airports "${SOURCES}" "${HEADERS}")
\ No newline at end of file
diff --git a/src/Autopilot/CMakeLists.txt b/src/Autopilot/CMakeLists.txt
index 23f297d2a..130edc0ab 100644
--- a/src/Autopilot/CMakeLists.txt
+++ b/src/Autopilot/CMakeLists.txt
@@ -16,4 +16,20 @@ set(SOURCES
 	route_mgr.cxx
 	)
 	
-flightgear_component(Autopilot "${SOURCES}")
\ No newline at end of file
+set(HEADERS
+	analogcomponent.hxx
+	autopilot.hxx
+	autopilotgroup.hxx
+	component.hxx
+	digitalcomponent.hxx
+	digitalfilter.hxx
+	flipflop.hxx
+	inputvalue.hxx
+	logic.hxx
+	pidcontroller.hxx
+	pisimplecontroller.hxx
+	predictor.hxx
+	route_mgr.hxx
+	)
+    	
+flightgear_component(Autopilot "${SOURCES}" "${HEADERS}")
\ No newline at end of file
diff --git a/src/Cockpit/CMakeLists.txt b/src/Cockpit/CMakeLists.txt
index a9a070d74..d68022e77 100644
--- a/src/Cockpit/CMakeLists.txt
+++ b/src/Cockpit/CMakeLists.txt
@@ -6,4 +6,11 @@ set(SOURCES
 	built_in/FGMagRibbon.cxx
 	)
 	
-flightgear_component(Cockpit "${SOURCES}")
\ No newline at end of file
+set(HEADERS
+	panel.hxx
+	panel_io.hxx
+	built_in/FGMagRibbon.hxx
+	)
+
+
+flightgear_component(Cockpit "${SOURCES}" "${HEADERS}")
\ No newline at end of file
diff --git a/src/Environment/CMakeLists.txt b/src/Environment/CMakeLists.txt
index ada06638e..3007eb781 100644
--- a/src/Environment/CMakeLists.txt
+++ b/src/Environment/CMakeLists.txt
@@ -18,5 +18,24 @@ set(SOURCES
 	presets.cxx
 	gravity.cxx
 	)
-	
-flightgear_component(Environment "${SOURCES}")
+
+set(HEADERS
+	atmosphere.hxx
+	environment.hxx
+	environment_ctrl.hxx
+	environment_mgr.hxx
+	ephemeris.hxx
+	fgclouds.hxx
+	fgmetar.hxx
+	fgwind.hxx
+	metarairportfilter.hxx
+	metarproperties.hxx
+	precipitation_mgr.hxx
+	realwx_ctrl.hxx
+	ridge_lift.hxx
+	terrainsampler.hxx
+	presets.hxx
+	gravity.hxx
+	)
+    		
+flightgear_component(Environment "${SOURCES}" "${HEADERS}")
diff --git a/src/GUI/CMakeLists.txt b/src/GUI/CMakeLists.txt
index 706219c74..428cdcb9e 100644
--- a/src/GUI/CMakeLists.txt
+++ b/src/GUI/CMakeLists.txt
@@ -15,5 +15,18 @@ set(SOURCES
 	new_gui.cxx
 	property_list.cxx
 	)
-	
-flightgear_component(GUI "${SOURCES}")
+
+set(HEADERS
+	AirportList.hxx
+	MapWidget.hxx
+	SafeTexFont.hxx
+	WaypointList.hxx
+	dialog.hxx
+	gui.h
+	layout.hxx
+	menubar.hxx
+	new_gui.hxx
+	property_list.hxx
+	)
+    		
+flightgear_component(GUI "${SOURCES}" "${HEADERS}")
diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt
index d28d78d26..c03bdaeed 100644
--- a/src/Main/CMakeLists.txt
+++ b/src/Main/CMakeLists.txt
@@ -31,8 +31,29 @@ set(SOURCES
 	viewmgr.cxx
 	${RESOURCE_FILE}
 	)
-	
-add_executable(fgfs ${SOURCES})
+
+set(HEADERS
+	CameraGroup.hxx
+	FGEventHandler.hxx
+	WindowBuilder.hxx
+	WindowSystemAdapter.hxx
+	fg_commands.hxx
+	fg_init.hxx
+	fg_io.hxx
+	fg_props.hxx
+	fgviewer.hxx
+	globals.hxx
+	logger.hxx
+	main.hxx
+	options.hxx
+	renderer.hxx
+	splash.hxx
+	util.hxx
+	viewer.hxx
+	viewmgr.hxx
+	)
+
+add_executable(fgfs ${SOURCES} ${HEADERS})
 
 get_property(FG_LIBS GLOBAL PROPERTY FG_LIBS)
 #message(STATUS "fg libs ${FG_LIBS}")
diff --git a/src/Navaids/CMakeLists.txt b/src/Navaids/CMakeLists.txt
index 8f2747270..05a999cb3 100644
--- a/src/Navaids/CMakeLists.txt
+++ b/src/Navaids/CMakeLists.txt
@@ -2,7 +2,6 @@ include(FlightGearComponent)
 
 set(SOURCES
 	airways.cxx
-	awynet.cxx
 	fixlist.cxx
 	markerbeacon.cxx
 	navdb.cxx
@@ -16,4 +15,19 @@ set(SOURCES
 	PositionedBinding.cxx
 	)
 
-flightgear_component(Navaids "${SOURCES}")
\ No newline at end of file
+set(HEADERS
+    airways.hxx
+	fixlist.hxx
+	markerbeacon.hxx
+	navdb.hxx
+	navlist.hxx
+	navrecord.hxx
+	positioned.hxx
+	procedure.hxx
+	route.hxx
+	routePath.hxx
+	waypoint.hxx
+	PositionedBinding.hxx
+    )
+
+flightgear_component(Navaids "${SOURCES}" "${HEADERS}")
\ No newline at end of file