Changeset 474 for branches


Ignore:
Timestamp:
03/20/14 14:18:13 (5 years ago)
Author:
jls17
Message:
  • moved the source file list into project.cmake/files.cmake
  • moved the visual studio precompiled header support function into its own cmake file
  • added VS-filter support in case the visual studio solution is created by cmake
  • added all header files as dependencies so it's easier to rebuild the program in case a header is changed
Location:
branches/work_304
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/work_304/CMakeLists.txt

    r461 r474  
    2424 
    2525MESSAGE(STATUS "System Name: ${CMAKE_SYSTEM_NAME}") 
    26  
    27 ## *** taken from http://stackoverflow.com/questions/148570/using-pre-compiled-headers-with-cmake *** 
    28 ## To use it, the PrecompiledSource file shouldn't be specified in SourceVar array. Otherwise the 
    29 ## file specific precompiled properties will get overwritten. 
    30 MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar) 
    31   IF(MSVC) 
    32         MESSAGE(STATUS "Setting up precompiler header support") 
    33     GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE) 
    34     SET(PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${PrecompiledBasename}.pch") 
    35     SET(Sources ${${SourcesVar}}) 
    36  
    37     SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource} 
    38                                 PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\"" 
    39                                            OBJECT_OUTPUTS "${PrecompiledBinary}") 
    40                                                                                     
    41     SET_SOURCE_FILES_PROPERTIES(${Sources} 
    42                                 PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledBinary}\" /FI\"${PrecompiledBinary}\" /Fp\"${PrecompiledBinary}\"" 
    43                                            OBJECT_DEPENDS "${PrecompiledBinary}")   
    44     # Add precompiled header to SourcesVar 
    45     LIST(APPEND ${SourcesVar} ${PrecompiledSource}) 
    46   ENDIF(MSVC) 
    47 ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER) 
     26INCLUDE(project.cmake/msvc_pch_support.cmake) 
     27 
     28#define project names 
     29SET(MAIN_PROJECT_NAME "ARInside") 
     30SET(LIB_PROJECT_NAME "ARInsideLib") 
     31SET(TEST_PROJECT_NAME "ARInsideTest") 
     32SET(RES_PROJECT_NAME "ARInsideRes") 
     33IF(UNIX) 
     34  STRING(TOLOWER ${MAIN_PROJECT_NAME} MAIN_PROJECT_NAME) 
     35  STRING(TOLOWER ${LIB_PROJECT_NAME} LIB_PROJECT_NAME) 
     36  STRING(TOLOWER ${TEST_PROJECT_NAME} TEST_PROJECT_NAME) 
     37  STRING(TOLOWER ${RES_PROJECT_NAME} RES_PROJECT_NAME) 
     38ENDIF(UNIX) 
    4839 
    4940# configurable variables for cmakegui 
     
    9384ENDIF(UNIX AND CMAKE_COMPILER_IS_GNUCXX AND ARINSIDE_TARGET_ARCHITECTURE EQUAL 4 AND CMAKE_SIZEOF_VOID_P EQUAL 8) 
    9485 
    95 SET (ARINSIDE_SRCS 
    96  core/ARContainer.cpp core/ARGlobalField.cpp core/ARServerObject.cpp 
    97  core/ARObject.cpp core/ARProplistHelper.cpp core/ARGroup.cpp core/ARAssignHelper.cpp 
    98  core/ARDayStructHelper.cpp core/ARFilter.cpp core/ARVui.cpp core/AREscalation.cpp core/ARQualification.cpp 
    99  core/ARServerInfo.cpp core/ARSchema.cpp core/ChangeHistoryEntry.cpp core/ARField.cpp core/ARUser.cpp 
    100  core/ARImage.cpp core/ARCharMenu.cpp core/ARRole.cpp core/ARActiveLink.cpp core/ARValue.cpp 
    101  core/ARSetFieldHelper.cpp core/ARHandle.cpp core/AREnum.cpp core/ARStatusList.cpp 
    102  doc/DocFieldDetails.cpp doc/DocFilterActionStruct.cpp doc/DocAlActionStruct.cpp doc/DocBase.cpp  
    103  doc/DocUserDetails.cpp doc/DocVuiDetails.cpp doc/DocWebserviceDetails.cpp doc/DocMain.cpp 
    104  doc/DocActionSetFieldsHelper.cpp doc/DocFilterGuideDetails.cpp doc/DocAlDetails.cpp 
    105  doc/DocCharMenuDetails.cpp doc/DocContainerHelper.cpp doc/DocRoleDetails.cpp doc/DocAnalyzer.cpp 
    106  doc/DocSchemaDetails.cpp doc/DocValidator.cpp doc/DocFilterDetails.cpp doc/DocImageDetails.cpp 
    107  doc/DocActionOpenWindowHelper.cpp doc/DocPacklistDetails.cpp doc/DocApplicationDetails.cpp 
    108  doc/DocGroupDetails.cpp doc/MessageItem.cpp doc/DocEscalationDetails.cpp doc/DocSummaryInfo.cpp 
    109  doc/DocAlGuideDetails.cpp doc/DocCustomWorkflow.cpp doc/DocOverlayHelper.cpp doc/DocAllMatchingIdsTable.cpp 
    110  doc/DocImageOverview.cpp 
    111  lists/ARActiveLinkList.cpp lists/ARContainerList.cpp lists/AREscalationList.cpp lists/ARFieldList.cpp 
    112  lists/ARFilterList.cpp lists/ARGroupList.cpp lists/ARImageList.cpp lists/ARMenuList.cpp lists/ARRoleList.cpp 
    113  lists/ARSchemaList.cpp lists/ARUserList.cpp lists/ARVUIList.cpp lists/BlackList.cpp lists/ARListHelpers.cpp 
    114  lists/ARServerInfoList.cpp 
    115  lists/support/SchemaDbQueryBuilder.cpp 
    116  output/Table.cpp output/TableCell.cpp output/WebControl.cpp output/AlTable.cpp output/EscalTable.cpp 
    117  output/UList.cpp output/FilterTable.cpp output/IFileStructure.cpp output/CsvPage.cpp output/ObjectTable.cpp 
    118  output/FileNaming.cpp output/TableRow.cpp output/SchemaTable.cpp output/RoleTable.cpp output/ContainerTable.cpp 
    119  output/WebPage.cpp output/TableColumn.cpp output/NavigationPage.cpp output/GroupTable.cpp output/ImageTable.cpp 
    120  output/UListItem.cpp output/MenuTable.cpp output/UserTable.cpp output/WebUtil.cpp output/TabControl.cpp 
    121  output/webpage/HtmlReferenceList.cpp output/webpage/HtmlReferenceListImpl.cpp output/LetterFilterControl.cpp 
    122  scan/ScanActiveLinks.cpp scan/ScanContainers.cpp scan/ScanEscalations.cpp scan/ScanFields.cpp scan/ScanFilters.cpp 
    123  scan/ScanImages.cpp scan/ScanMain.cpp scan/ScanMenus.cpp scan/ScanSchema.cpp 
    124  thirdparty/tinyxml/tinyxml.cpp thirdparty/tinyxml/tinystr.cpp thirdparty/tinyxml/tinyxmlerror.cpp  
    125  thirdparty/tinyxml/tinyxmlparser.cpp 
    126  util/AppTimer.cpp util/BlackListItem.cpp util/CommandLineValidator.cpp util/RefItem.cpp  
    127  util/ResourceFileLocatorAndExtractor.cpp util/UntarStream.cpp util/Util.cpp  
    128  AppConfig.cpp AppConfigReader.cpp ARInside.cpp ConfigFile.cpp FileSystemUtil.cpp gzstream.cpp Main.cpp 
    129 ) 
    130  
    131 SET(ARINSIDE_MAIN_SRCS ARInsideMain.cpp ARInsideMain.h) 
    132 SET(ARINSIDE_TEST_SRCS ARInsideTest.cpp ARInsideTest.h 
    133  AppConfigReaderTest.cpp FileSystemUtilTest.cpp RapidJSONTests.cpp 
    134  lists/ARListHelpersTest.cpp  
    135  lists/support/SchemaDbQueryBuilderTest.cpp 
    136  output/webpage/HtmlReferenceListImplTest.cpp 
    137  util/CommandLineValidatorTest.cpp util/UntarStreamTest.cpp util/UntarStreamTest.h 
    138 ) 
    139  
    140 IF(NOT MSVC) 
    141         SET (ARINSIDE_SRCS ${ARINSIDE_SRCS} stdafx.cpp) 
    142 ENDIF(NOT MSVC) 
     86INCLUDE(project.cmake/files.cmake) 
    14387 
    14488# set link libraries for project 
     
    247191 
    248192# now generate and import resources 
    249 ADD_CUSTOM_TARGET(arinsideresdir ALL 
     193ADD_CUSTOM_TARGET(resource_directory ALL 
    250194        COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/img 
    251195        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res/active_link.gif ${CMAKE_BINARY_DIR}/img 
     
    306250) 
    307251 
    308 ADD_CUSTOM_TARGET(arinsideres ALL  
    309         COMMAND ${CMAKE_COMMAND} -E tar "czf" "${arinside_BINARY_DIR}/arires.tgz" img WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" DEPENDS arinsideresdir 
     252ADD_CUSTOM_TARGET(${RES_PROJECT_NAME} ALL  
     253        COMMAND ${CMAKE_COMMAND} -E tar "czf" "${arinside_BINARY_DIR}/arires.tgz" img WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" DEPENDS resource_directory 
    310254) 
    311255 
     
    313257        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gtest-1.6.0.zip ${CMAKE_BINARY_DIR}/thirdparty/src/ 
    314258) 
    315  
    316 ADD_MSVC_PRECOMPILED_HEADER("stdafx.h" "stdafx.cpp" ARINSIDE_SRCS) 
    317259 
    318260# generate svnrev.h file 
     
    364306 
    365307# setup output target 
    366 ADD_LIBRARY(arinsidelib ${ARINSIDE_SRCS} ${ARINSIDE_RESOURCE_OBJECTS}) 
    367 ADD_EXECUTABLE(arinside ${ARINSIDE_MAIN_SRCS}) 
    368 ADD_EXECUTABLE(arinsidetest ${ARINSIDE_TEST_SRCS}) 
     308ADD_LIBRARY(${LIB_PROJECT_NAME} ${ARINSIDE_SRCS} ${ARINSIDE_RESOURCE_OBJECTS}) 
     309ADD_EXECUTABLE(${MAIN_PROJECT_NAME} ${ARINSIDE_MAIN_SRCS}) 
     310ADD_EXECUTABLE(${TEST_PROJECT_NAME} ${ARINSIDE_TEST_SRCS}) 
    369311 
    370312# dependencies 
    371 ADD_DEPENDENCIES(arinsidetest arinsidelib googletest) 
    372 ADD_DEPENDENCIES(arinside arinsidelib arinsideres) 
     313ADD_DEPENDENCIES(${TEST_PROJECT_NAME} ${LIB_PROJECT_NAME} googletest) 
     314ADD_DEPENDENCIES(${MAIN_PROJECT_NAME} ${LIB_PROJECT_NAME} ${RES_PROJECT_NAME}) 
    373315 
    374316# reference the needed libraries 
    375 TARGET_LINK_LIBRARIES(arinside ${ARS_API_LIB} ${ZLIB_LIB} ${ARINSIDE_ADDITIONAL_LIBS} arinsidelib) 
    376 TARGET_LINK_LIBRARIES(arinsidetest ${ARS_API_LIB} ${ZLIB_LIB} ${ARINSIDE_ADDITIONAL_LIBS} arinsidelib) 
     317TARGET_LINK_LIBRARIES(${MAIN_PROJECT_NAME} ${ARS_API_LIB} ${ZLIB_LIB} ${ARINSIDE_ADDITIONAL_LIBS} ${LIB_PROJECT_NAME}) 
     318TARGET_LINK_LIBRARIES(${TEST_PROJECT_NAME} ${ARS_API_LIB} ${ZLIB_LIB} ${ARINSIDE_ADDITIONAL_LIBS} ${LIB_PROJECT_NAME}) 
    377319IF(MSVC) 
    378         TARGET_LINK_LIBRARIES(arinsidetest 
     320        TARGET_LINK_LIBRARIES(${TEST_PROJECT_NAME} 
    379321                debug ${GTEST_BINARY_DIR}/DebugLibs/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_FIND_LIBRARY_SUFFIXES} 
    380322                optimized ${GTEST_BINARY_DIR}/ReleaseLibs/${CMAKE_FIND_LIBRARY_PREFIXES}gtest${CMAKE_FIND_LIBRARY_SUFFIXES} 
    381323        ) 
    382324ELSE(MSVC) 
    383         TARGET_LINK_LIBRARIES(arinsidetest gtest) 
     325        TARGET_LINK_LIBRARIES(${TEST_PROJECT_NAME} gtest) 
    384326ENDIF(MSVC) 
    385327 
    386 ADD_TEST(NAME test COMMAND arinsidetest) 
     328ADD_TEST(NAME test COMMAND ${TEST_PROJECT_NAME}) 
    387329#INSTALL(TARGETS arinside DESTINATION bin) 
Note: See TracChangeset for help on using the changeset viewer.