--- FlightCrew-0.7.2-Code/CMakeLists.txt.use-system-libs 2011-08-11 21:03:56.000000000 +0800 +++ FlightCrew-0.7.2-Code/CMakeLists.txt 2012-08-02 13:58:03.000000000 +0800 @@ -40,11 +40,19 @@ # Universal builds for mac set( CMAKE_OSX_ARCHITECTURES "i386;x86_64" ) +if( UNIX ) + find_package( Boost 1.36.0 COMPONENTS date_time thread program_options filesystem regex) +endif( UNIX ) + # The parsing order is significant! +if( NOT UNIX ) add_subdirectory( src/BoostParts ) add_subdirectory( src/Xerces ) +endif( NOT UNIX ) add_subdirectory( src/XercesExtensions ) +if( NOT UNIX ) add_subdirectory( src/zlib ) +endif( NOT UNIX ) add_subdirectory( src/zipios ) add_subdirectory( src/googlemock ) add_subdirectory( src/FlightCrew ) --- FlightCrew-0.7.2-Code/src/FlightCrew-cli/CMakeLists.txt.use-system-libs 2011-08-11 21:03:56.000000000 +0800 +++ FlightCrew-0.7.2-Code/src/FlightCrew-cli/CMakeLists.txt 2012-08-02 13:58:03.000000000 +0800 @@ -37,7 +37,7 @@ add_executable( ${PROJECT_NAME} ${SOURCES} ) -target_link_libraries( ${PROJECT_NAME} FlightCrew ) +target_link_libraries( ${PROJECT_NAME} FlightCrew ${Boost_PROGRAM_OPTIONS_LIBRARY} ) ############################################################################# --- FlightCrew-0.7.2-Code/src/FlightCrew/CMakeLists.txt.orig.use-system-libs 2012-08-02 13:58:03.000000000 +0800 +++ FlightCrew-0.7.2-Code/src/FlightCrew/CMakeLists.txt.orig 2012-08-02 13:58:03.000000000 +0800 @@ -0,0 +1,135 @@ +######################################################## +# +# This is a CMake configuration file. +# To use it you need CMake which can be +# downloaded from here: +# http://www.cmake.org/cmake/resources/software.html +# +######################################################### + +cmake_minimum_required( VERSION 2.8 ) + +# Print a message and fail for people who don't +# read the build instructions and then complain +# when the build process fails for them. +if ( ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR} ) + message( FATAL_ERROR "You are trying to run CMake from the <top_folder>/src/FlightCrew directory, " + "instead of just from the <top_folder> directory.\nDO NOT DO THIS.\n" + "The correct way looks like this:\n" + " cmake -G '<generator_name>' /path/to/topmost/folder/in/source/package\n" + "You will probably now need to first clean your build directory." ) +endif() + +############################################################################# + +project( FlightCrew ) + +file( GLOB_RECURSE SOURCES *.h *.cpp *.xsd *.dtd ) + +# The test sources are a part of a different target, so we remove them +file( GLOB_RECURSE to_remove tests/*.h tests/*.cpp ) +list( REMOVE_ITEM SOURCES ${to_remove} ) + +############################################################################# + +# Creating source groups for VS, Xcode +include( ${CMAKE_SOURCE_DIR}/cmake_extras/FileSystemSourceGroups.cmake ) +create_source_groups( SOURCES ) + +############################################################################# + +set( PCH_NAME stdafx ) + +# stdafx.cpp is compiled separately as a PCH +file( GLOB to_remove ${PCH_NAME}.cpp ) +list( REMOVE_ITEM SOURCES ${to_remove} ) + +############################################################################# + +# creating PCH's for MSVC and GCC on Linux +include( ${CMAKE_SOURCE_DIR}/cmake_extras/CustomPCH.cmake ) +set( ALL_INCLUDES ${BoostParts_SOURCE_DIR} + ${Xerces_SOURCE_DIR} + ${zipios_SOURCE_DIR} ) +set( GCC_PCH_TARGET gccPCH_fc ) + +precompiled_header( SOURCES ALL_INCLUDES ${GCC_PCH_TARGET} ${PCH_NAME} ) + +############################################################################# + +# We need to pick up the stdafx.h file (current source dir), +# the stdafx.h.gch file (current binary dir) +# and the headers for the linked-to libraries +include_directories( ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ../zipios + ../BoostParts + ../Xerces + ../XercesExtensions + ../utf8-cpp + ) + +link_directories ( ${PROJECT_BINARY_DIR}/lib ) + +if( BUILD_SHARED_FC ) + # Windows clients also need to specify FC_BUILT_AS_DLL + # when they want a dll, but NOT FC_DLL_EXPORTING + add_definitions( -DFC_DLL_EXPORTING -DFC_BUILT_AS_DLL ) + add_library( ${PROJECT_NAME} SHARED ${SOURCES} ) +else() + add_library( ${PROJECT_NAME} ${SOURCES} ) +endif() + +target_link_libraries( ${PROJECT_NAME} zipios BoostParts XercesExtensions ) + +############################################################################# + +# Xcode PCH support. Has to come after the target is created. +if( APPLE ) + set_target_properties( + ${PROJECT_NAME} + PROPERTIES + XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/${PCH_NAME}.h" + XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES" + ) +endif() + +############################################################################# + +# "Link time code generation" flags for MSVC +# TODO: split into special cmake file +if( MSVC ) + add_definitions( /DUNICODE /D_UNICODE /W4 ) + + # This warning is present only at the highest warning level (/W4) + # and is routinely disabled because it complains about valid + # constructs like "while (true)" + add_definitions( /wd4127 ) + + # The /Zc:wchar_t- flag can't go into add_definitions + # because the RC compiler picks it up too and it provokes a name clash + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t-") + set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL" ) + set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" ) + +elseif( CMAKE_COMPILER_IS_GNUCXX ) + # "Print all warnings" flag for GCC + add_definitions( -Wall ) + + # Make sure the PCH is built for GCC + add_dependencies( ${PROJECT_NAME} ${GCC_PCH_TARGET} ) +endif() + +# needed for correct Xerces header inclusion +add_definitions( -DXERCES_STATIC_LIBRARY ) + +############################################################################# + +# We don't build the tests when fc is built as a shared +# library on msvc since the tests need access to the fc +# internal apis which are not exported when building a DLL. +# If we tried to build them, we would get linker errors. +# We also don't build the tests if the user specified it. +if( NOT ( BUILD_SHARED_FC AND MSVC ) AND NOT NO_TEST_EXE ) + add_subdirectory( tests ) +endif() --- FlightCrew-0.7.2-Code/src/FlightCrew/CMakeLists.txt.use-system-libs 2011-08-11 21:03:56.000000000 +0800 +++ FlightCrew-0.7.2-Code/src/FlightCrew/CMakeLists.txt 2012-08-02 14:00:45.000000000 +0800 @@ -50,9 +50,7 @@ # creating PCH's for MSVC and GCC on Linux include( ${CMAKE_SOURCE_DIR}/cmake_extras/CustomPCH.cmake ) -set( ALL_INCLUDES ${BoostParts_SOURCE_DIR} - ${Xerces_SOURCE_DIR} - ${zipios_SOURCE_DIR} ) +set( ALL_INCLUDES ${zipios_SOURCE_DIR} ) set( GCC_PCH_TARGET gccPCH_fc ) precompiled_header( SOURCES ALL_INCLUDES ${GCC_PCH_TARGET} ${PCH_NAME} ) @@ -62,6 +60,14 @@ # We need to pick up the stdafx.h file (current source dir), # the stdafx.h.gch file (current binary dir) # and the headers for the linked-to libraries +if(UNIX) + include_directories( ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ../zipios + ../XercesExtensions + ../utf8-cpp + ) +else(UNIX) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ../zipios @@ -70,7 +76,7 @@ ../XercesExtensions ../utf8-cpp ) - +endif(UNIX) link_directories ( ${PROJECT_BINARY_DIR}/lib ) if( BUILD_SHARED_FC ) @@ -82,8 +88,14 @@ add_library( ${PROJECT_NAME} ${SOURCES} ) endif() -target_link_libraries( ${PROJECT_NAME} zipios BoostParts XercesExtensions ) - +target_link_libraries( ${PROJECT_NAME} zipios XercesExtensions ) +if ( UNIX ) + # These seem to not be actually currently used, left just in case + # this changes in the future (-Wl,--as-needed pulls them out until then) + target_link_libraries( ${PROJECT_NAME} ${Boost_DATA_TIME_LIBRARY} ${Boost_THREAD_LIBRARY} ) +else() + target_link_libraries( ${PROJECT_NAME} BoostParts ) +endif() ############################################################################# # Xcode PCH support. Has to come after the target is created. --- FlightCrew-0.7.2-Code/src/utf8-cpp/utf8/core.h.use-system-libs 2011-08-11 21:03:56.000000000 +0800 +++ FlightCrew-0.7.2-Code/src/utf8-cpp/utf8/core.h 2012-08-02 13:58:03.000000000 +0800 @@ -29,7 +29,7 @@ #define UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 #include <iterator> -#include "../../BoostParts/boost/cstdint.hpp" +#include <boost/cstdint.hpp> namespace utf8 { --- FlightCrew-0.7.2-Code/src/XercesExtensions/CMakeLists.txt.use-system-libs 2011-08-11 21:03:56.000000000 +0800 +++ FlightCrew-0.7.2-Code/src/XercesExtensions/CMakeLists.txt 2012-08-02 13:58:03.000000000 +0800 @@ -23,7 +23,7 @@ add_library( ${PROJECT_NAME} ${SOURCES} ) -target_link_libraries( ${PROJECT_NAME} Xerces ) +target_link_libraries( ${PROJECT_NAME} xerces-c ) ############################################################################# --- FlightCrew-0.7.2-Code/src/zipios/CMakeLists.txt.use-system-libs 2011-08-11 21:03:56.000000000 +0800 +++ FlightCrew-0.7.2-Code/src/zipios/CMakeLists.txt 2012-08-02 13:58:03.000000000 +0800 @@ -25,7 +25,12 @@ add_library( ${PROJECT_NAME} ${SOURCES} ) -target_link_libraries( ${PROJECT_NAME} zlib BoostParts ) +target_link_libraries( ${PROJECT_NAME} z ) +if ( UNIX ) + target_link_libraries( ${PROJECT_NAME} ${Boost_FILESYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ) +else() + target_link_libraries( ${PROJECT_NAME} BoostParts ) +endif() ############################################################################# --- FlightCrew-0.7.2-Code/src/FlightCrew/tests/CMakeLists.txt.system-libs 2012-08-02 14:10:34.000000000 +0800 +++ FlightCrew-0.7.2-Code/src/FlightCrew/tests/CMakeLists.txt 2012-08-02 14:11:26.000000000 +0800 @@ -42,12 +42,15 @@ # So techincally we don't need to include Xerces etc. include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} - ../../BoostParts - ../../Xerces ../../XercesExtensions ../../googlemock/include ../../googlemock/gtest/include ) +if(NOT UNIX) + include_directories(../../BoostParts + ../../Xerces + ) +endif(NOT UNIX) link_directories ( ${PROJECT_BINARY_DIR}/lib )