cmake_minimum_required(VERSION 2.6)

project(p7zip)

IF(HAVE_WCHAR_H)
  OPTION(HAVE_UNICODE_WCHAR "Enable Unicode Support" YES)
  MARK_AS_ADVANCED(HAVE_UNICODE_WCHAR)
ELSE(HAVE_WCHAR_H)
  SET(HAVE_UNICODE_WCHAR 0)
ENDIF(HAVE_WCHAR_H)

SET(HAVE_PTHREADS 0)
FIND_PACKAGE(Threads)
IF(WIN32 OR CMAKE_USE_PTHREADS_INIT)
  SET(HAVE_PTHREADS 1)
ENDIF(WIN32 OR CMAKE_USE_PTHREADS_INIT)

include_directories(
	../../../myWindows
	../../../
	../../../include_windows
)

add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -DENV_UNIX -DCOMPRESS_MT -DCOMPRESS_BZIP2_MT -DCOMPRESS_MF_MT -DBREAK_HANDLER -DBENCH_MT)  

add_executable(7za
 ../../../myWindows/myGetTickCount.cpp
 ../../../myWindows/wine_date_and_time.cpp
 ../../../myWindows/myAddExeFlag.cpp
 ../../../myWindows/mySplitCommandLine.cpp

 ../../UI/Console/ConsoleClose.cpp
 ../../UI/Console/ExtractCallbackConsole.cpp
 ../../UI/Console/List.cpp
 ../../UI/Console/Main.cpp
 ../../UI/Console/MainAr.cpp
 ../../UI/Console/OpenCallbackConsole.cpp
 ../../UI/Console/PercentPrinter.cpp
 ../../UI/Console/UpdateCallbackConsole.cpp
 ../../UI/Console/UserInputUtils.cpp

 ../../../Common/CommandLineParser.cpp
 ../../../Common/CRC.cpp
 ../../../Common/IntToString.cpp
 ../../../Common/ListFileUtils.cpp
 ../../../Common/StdInStream.cpp
 ../../../Common/StdOutStream.cpp
 ../../../Common/MyString.cpp
 ../../../Common/MyWindows.cpp
 ../../../Common/StringConvert.cpp
 ../../../Common/StringToInt.cpp
 ../../../Common/UTFConvert.cpp
 ../../../Common/MyVector.cpp
 ../../../Common/Wildcard.cpp

 ../../../Windows/Error.cpp
 ../../../Windows/FileDir.cpp
 ../../../Windows/FileFind.cpp
 ../../../Windows/FileIO.cpp
 ../../../Windows/FileName.cpp
 ../../../Windows/PropVariant.cpp
 ../../../Windows/PropVariantConversions.cpp
 ../../../Windows/Synchronization.cpp
 ../../../Windows/System.cpp
 ../../../Windows/Time.cpp

 ../../Common/CreateCoder.cpp
 ../../Common/FilePathAutoRename.cpp
 ../../Common/FileStreams.cpp
 ../../Common/FilterCoder.cpp
 ../../Common/InBuffer.cpp
 ../../Common/InOutTempBuffer.cpp
 ../../Common/LimitedStreams.cpp
 ../../Common/LockedStream.cpp
 ../../Common/MemBlocks.cpp
 ../../Common/MethodId.cpp
 ../../Common/MethodProps.cpp
 ../../Common/OffsetStream.cpp
 ../../Common/OutBuffer.cpp
 ../../Common/OutMemStream.cpp
 ../../Common/ProgressMt.cpp
 ../../Common/ProgressUtils.cpp
 ../../Common/StreamBinder.cpp
 ../../Common/StreamObjects.cpp
 ../../Common/StreamUtils.cpp
 ../../Common/VirtThread.cpp

 ../../UI/Common/ArchiveCommandLine.cpp
 ../../UI/Common/ArchiveExtractCallback.cpp
 ../../UI/Common/ArchiveOpenCallback.cpp
 ../../UI/Common/DefaultName.cpp
 ../../UI/Common/EnumDirItems.cpp
 ../../UI/Common/Extract.cpp
 ../../UI/Common/ExtractingFilePath.cpp
 ../../UI/Common/LoadCodecs.cpp
 ../../UI/Common/OpenArchive.cpp
 ../../UI/Common/PropIDUtils.cpp
 ../../UI/Common/SetProperties.cpp
 ../../UI/Common/SortUtils.cpp
 ../../UI/Common/TempFiles.cpp
 ../../UI/Common/Update.cpp
 ../../UI/Common/UpdateAction.cpp
 ../../UI/Common/UpdateCallback.cpp
 ../../UI/Common/UpdatePair.cpp
 ../../UI/Common/UpdateProduce.cpp

 ../../Archive/ZHandler.cpp

 ../../Archive/Common/CoderMixer2.cpp
 ../../Archive/Common/CoderMixer2MT.cpp
 ../../Archive/Common/CrossThreadProgress.cpp
 ../../Archive/Common/DummyOutStream.cpp
 ../../Archive/Common/FindSignature.cpp
 ../../Archive/Common/HandlerOut.cpp
 ../../Archive/Common/InStreamWithCRC.cpp
 ../../Archive/Common/ItemNameUtils.cpp
 ../../Archive/Common/MultiStream.cpp
 ../../Archive/Common/OutStreamWithCRC.cpp
 ../../Archive/Common/ParseProperties.cpp

 ../../Archive/7z/7zCompressionMode.cpp
 ../../Archive/7z/7zDecode.cpp
 ../../Archive/7z/7zEncode.cpp
 ../../Archive/7z/7zExtract.cpp
 ../../Archive/7z/7zFolderInStream.cpp
 ../../Archive/7z/7zFolderOutStream.cpp
 ../../Archive/7z/7zHandler.cpp
 ../../Archive/7z/7zHandlerOut.cpp
 ../../Archive/7z/7zHeader.cpp
 ../../Archive/7z/7zIn.cpp
 ../../Archive/7z/7zOut.cpp
 ../../Archive/7z/7zProperties.cpp
 ../../Archive/7z/7zSpecStream.cpp
 ../../Archive/7z/7zUpdate.cpp
 ../../Archive/7z/7zRegister.cpp

 ../../Archive/BZip2/BZip2Handler.cpp
 ../../Archive/BZip2/BZip2HandlerOut.cpp
 ../../Archive/BZip2/BZip2Update.cpp
 ../../Archive/BZip2/bz2Register.cpp

 ../../Archive/Cab/CabBlockInStream.cpp
 ../../Archive/Cab/CabHandler.cpp
 ../../Archive/Cab/CabHeader.cpp
 ../../Archive/Cab/CabIn.cpp
 ../../Archive/Cab/CabRegister.cpp

 ../../Archive/GZip/GZipHandler.cpp
 ../../Archive/GZip/GZipHandlerOut.cpp
 ../../Archive/GZip/GZipHeader.cpp
 ../../Archive/GZip/GZipIn.cpp
 ../../Archive/GZip/GZipOut.cpp
 ../../Archive/GZip/GZipRegister.cpp
 ../../Archive/GZip/GZipUpdate.cpp

 ../../Archive/Lzma/LzmaArcRegister.cpp
 ../../Archive/Lzma/LzmaFiltersDecode.cpp
 ../../Archive/Lzma/LzmaHandler.cpp
 ../../Archive/Lzma/LzmaIn.cpp

 ../../Archive/Split/SplitHandler.cpp
 ../../Archive/Split/SplitRegister.cpp

 ../../Archive/Tar/TarHandler.cpp
 ../../Archive/Tar/TarHandlerOut.cpp
 ../../Archive/Tar/TarHeader.cpp
 ../../Archive/Tar/TarIn.cpp
 ../../Archive/Tar/TarOut.cpp
 ../../Archive/Tar/TarRegister.cpp
 ../../Archive/Tar/TarUpdate.cpp

 ../../Archive/Zip/ZipAddCommon.cpp
 ../../Archive/Zip/ZipHandler.cpp
 ../../Archive/Zip/ZipHandlerOut.cpp
 ../../Archive/Zip/ZipHeader.cpp
 ../../Archive/Zip/ZipIn.cpp
 ../../Archive/Zip/ZipItem.cpp
 ../../Archive/Zip/ZipOut.cpp
 ../../Archive/Zip/ZipUpdate.cpp
 ../../Archive/Zip/ZipRegister.cpp

 ../../Compress/Bcj2Coder.cpp
 ../../Compress/Bcj2Register.cpp
 ../../Compress/BcjCoder.cpp
 ../../Compress/BcjRegister.cpp
 ../../Compress/BitlDecoder.cpp
 ../../Compress/BranchCoder.cpp
 ../../Compress/BranchMisc.cpp
 ../../Compress/BranchRegister.cpp
 ../../Compress/ByteSwap.cpp
 ../../Compress/ByteSwapRegister.cpp
 ../../Compress/BZip2Crc.cpp
 ../../Compress/BZip2Decoder.cpp
 ../../Compress/BZip2Encoder.cpp
 ../../Compress/BZip2Register.cpp
 ../../Compress/CopyCoder.cpp
 ../../Compress/CopyRegister.cpp
 ../../Compress/Deflate64Register.cpp
 ../../Compress/DeflateDecoder.cpp
 ../../Compress/DeflateEncoder.cpp
 ../../Compress/DeflateRegister.cpp
 ../../Compress/ImplodeDecoder.cpp
 ../../Compress/ImplodeHuffmanDecoder.cpp
 ../../Compress/LzmaDecoder.cpp
 ../../Compress/LzmaEncoder.cpp
 ../../Compress/LzmaRegister.cpp
 ../../Compress/LzOutWindow.cpp
 ../../Compress/Lzx86Converter.cpp
 ../../Compress/LzxDecoder.cpp
 ../../Compress/PpmdDecoder.cpp
 ../../Compress/PpmdEncoder.cpp
 ../../Compress/PpmdRegister.cpp
 ../../Compress/QuantumDecoder.cpp
 ../../Compress/ShrinkDecoder.cpp
 ../../Compress/ZDecoder.cpp
 ../../Compress/LZMA_Alone/LzmaBench.cpp
 ../../Compress/LZMA_Alone/LzmaBenchCon.cpp
 ../../Crypto/7zAes.cpp
 ../../Crypto/7zAesRegister.cpp
 ../../Crypto/HmacSha1.cpp
 ../../Crypto/MyAes.cpp
 ../../Crypto/Pbkdf2HmacSha1.cpp
 ../../Crypto/RandGen.cpp
 ../../Crypto/Sha1.cpp
 ../../Crypto/WzAes.cpp
 ../../Crypto/ZipCrypto.cpp
 ../../Crypto/ZipStrong.cpp
 ../../../../C/Bra.c
 ../../../../C/Bra86.c
 ../../../../C/BraIA64.c
 ../../../../C/BwtSort.c
 ../../../../C/HuffEnc.c
 ../../../../C/LzFind.c
 ../../../../C/LzFindMt.c
 ../../../../C/LzmaDec.c
 ../../../../C/LzmaEnc.c
 ../../../../C/Sort.c
 ../../../../C/Threads.c
 ../../../../C/Aes.c
 ../../../../C/Sha256.c
 ../../../../C/7zCrc.c

 )

IF(HAVE_PTHREADS)
  TARGET_LINK_LIBRARIES(7za ${CMAKE_THREAD_LIBS_INIT})
ENDIF(HAVE_PTHREADS)

