INCLUDE(PolycodeIncludes)

FIND_PACKAGE(Assimp REQUIRED)
INCLUDE_DIRECTORIES(
    ${ASSIMP_INCLUDE_DIR} 
    Include)

SET(CMAKE_DEBUG_POSTFIX "_d")

#IF(POLYCODE_BUILD_SHARED)
#    ADD_EXECUTABLE(polyimport_dynamic Source/polyimport.cpp Include/polyimport.h)
#    TARGET_LINK_LIBRARIES(polyimport_dynamic Polycore_dynamic ${ASSIMP_LIBRARIES})
#ENDIF(POLYCODE_BUILD_SHARED)

#IF(POLYCODE_BUILD_STATIC)
ADD_EXECUTABLE(polyimport Source/polyimport.cpp Include/polyimport.h)
IF(APPLE)
	TARGET_LINK_LIBRARIES(polyimport Polycore ${PHYSFS_LIBRARY}  ${ZLIB_LIBRARIES} ${ASSIMP_LIBRARY} "-framework IOKit" "-framework Cocoa")
ELSE()
	TARGET_LINK_LIBRARIES(polyimport Polycore ${PHYSFS_LIBRARY}  ${ZLIB_LIBRARIES} ${ASSIMP_LIBRARY})
ENDIF(APPLE)
#ENDIF(POLYCODE_BUILD_STATIC)

IF(POLYCODE_INSTALL_FRAMEWORK)

    # install exes
#    IF(POLYCODE_BUILD_SHARED)
#        INSTALL(TARGETS polyimport DESTINATION ${POLYCODE_RELEASE_DIR}/Framework/Tools)
#    ENDIF(POLYCODE_BUILD_SHARED)
    
#    IF(POLYCODE_BUILD_STATIC)
    INSTALL(TARGETS polyimport DESTINATION Tools)
#    ENDIF(POLYCODE_BUILD_STATIC)

ENDIF(POLYCODE_INSTALL_FRAMEWORK)

INCLUDE(PolycodeIncludes)

FIND_PACKAGE(Assimp REQUIRED)
INCLUDE_DIRECTORIES(
    ${ASSIMP_INCLUDE_DIR} 
    Include)

SET(CMAKE_DEBUG_POSTFIX "_d")

#IF(POLYCODE_BUILD_SHARED)
#    ADD_EXECUTABLE(polyimport_dynamic Source/polyimport.cpp Include/polyimport.h)
#    TARGET_LINK_LIBRARIES(polyimport_dynamic Polycore_dynamic ${ASSIMP_LIBRARIES})
#ENDIF(POLYCODE_BUILD_SHARED)

#IF(POLYCODE_BUILD_STATIC)
ADD_EXECUTABLE(polyimport Source/polyimport.cpp Include/polyimport.h)
IF(APPLE)
	TARGET_LINK_LIBRARIES(polyimport Polycore ${PHYSFS_LIBRARY}  ${ZLIB_LIBRARIES} ${ASSIMP_LIBRARY} "-framework IOKit" "-framework Cocoa")
ELSEIF(WIN32)
	TARGET_LINK_LIBRARIES(polyimport Polycore ${PHYSFS_LIBRARY}  ${ASSIMP_LIBRARY})
ELSE()
	TARGET_LINK_LIBRARIES(polyimport Polycore ${PHYSFS_LIBRARY}  ${ZLIB_LIBRARIES} ${ASSIMP_LIBRARY})
ENDIF(APPLE)
#ENDIF(POLYCODE_BUILD_STATIC)

IF(POLYCODE_INSTALL_FRAMEWORK)

    # install exes
#    IF(POLYCODE_BUILD_SHARED)
#        INSTALL(TARGETS polyimport DESTINATION ${POLYCODE_RELEASE_DIR}/Framework/Tools)
#    ENDIF(POLYCODE_BUILD_SHARED)
    
#    IF(POLYCODE_BUILD_STATIC)
    INSTALL(TARGETS polyimport DESTINATION Tools)
#    ENDIF(POLYCODE_BUILD_STATIC)

ENDIF(POLYCODE_INSTALL_FRAMEWORK)

Fix for multiply defined symbols fatal error in polyimport.cpp on win32
Fix for multiply defined symbols fatal error in polyimport.cpp on win32

* the assimp libraries appear to be compiled with zlib support already, so including them again when linking polyimport results in a multiply defined symbols error on visual studio 2010

* removed zlib from the list of link libraries for polyimport on win32 only

* not sure if this needs done on other platforms or not

* verified that polyimport.exe still works after this tweak

* full text of error:

assimp.lib(inflate.obj) : error LNK2005: _inflateInit2_ already defined in zlib.lib(zlib.dll) [Polycode\Build\Tools\Contents\polyimport\polyimport.vcxproj]
assimp.lib(inflate.obj) : error LNK2005: _inflate already defined in zlib.lib(zlib.dll) [Polycode\Build\Tools\Contents\polyimport\polyimport.vcxproj]
assimp.lib(inflate.obj) : error LNK2005: _inflateEnd already defined in zlib.lib(zlib.dll) [Polycode\Build\Tools\Contents\polyimport\polyimport.vcxproj]
Polycode\Build\Tools\Contents\polyimport\Release\polyimport.exe : fatal error LNK1169: one or more multiply defined symbols found [Polycode\Build\Tools\Contents\polyimport\polyimport.vcxproj]
