CMakeLists.txt
author Ryan C. Gordon <icculus@icculus.org>
Tue, 17 Dec 2013 22:16:27 -0500
changeset 0 d7ee4e2ed49d
child 10 85496558f3a4
permissions -rw-r--r--
Initial work. Goes far enough to decrypt and correctly verify the master key.

cmake_minimum_required(VERSION 2.8.10)
project(1pass)

# Set up some sanity stuff...
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    SET(LINUX TRUE)
endif()
if(APPLE)
    SET(MACOSX TRUE)
endif()
if(MSVC)
    SET(WINDOWS TRUE)
endif()

if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Debug CACHE STRING "None Debug Release RelWithDebInfo MinSizeRel" FORCE)
endif()
SET(DEBUG FALSE)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
    SET(DEBUG TRUE)
endif()


add_definitions(-D_REENTRANT=1)

if(DEBUG)
    add_definitions(-DDEBUG=1)
    add_definitions(-D_DEBUG=1)
else()
    add_definitions(-DNDEBUG=1)
    add_definitions(-D_NDEBUG=1)
endif()

if(WINDOWS)
    add_definitions(-DWIN32=1)
    add_definitions(-DOS_WIN32=1)
    add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
    add_definitions(-D_CRT_SECURE_NO_DEPRECATE=1)
endif()

if(LINUX)
    set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
    add_definitions(-D_FILE_OFFSET_BITS=64)
    add_definitions(-D_LARGEFILE_SOURCE=1)
endif()

if(LINUX OR MACOSX)
    if(DEBUG)
        add_definitions(-O0 -ggdb3)
    endif(DEBUG)
    add_definitions(-pipe -fsigned-char)
    set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}" CACHE STRING "compile flags" FORCE)

    add_definitions(-DLUA_USE_MKSTEMP=1)  # as opposed to tmpnam(), yuck!
    add_definitions(-DLUA_USE_ULONGJMP=1)
endif()


include(TestBigEndian)
test_big_endian(ONEPASS_IS_BIGENDIAN)
if(ONEPASS_IS_BIGENDIAN)
    add_definitions(-DPLATFORM_BIGENDIAN=1)
else()
    add_definitions(-DPLATFORM_LITTLEENDIAN=1)
endif()


include_directories("lua")

add_executable(1pass
    1pass.c
    pkcs5_pbkdf2.c
    aes.c
    md5.c
    sha1.c
    base64.c
    lua/lapi.c
    lua/ldebug.c
    lua/ldo.c
    lua/ldump.c
    lua/lfunc.c
    lua/lgc.c
    lua/lmem.c
    lua/lobject.c
    lua/lopcodes.c
    lua/lstate.c
    lua/lstring.c
    lua/ltable.c
    lua/ltm.c
    lua/lundump.c
    lua/lvm.c
    lua/lzio.c
    lua/lauxlib.c
    lua/lbaselib.c
    lua/lstrlib.c
    lua/ltablib.c
    lua/lctype.c
    lua/lparser.c
    lua/llex.c
    lua/lcode.c
    lua/linit.c
    lua/lctype.c
    lua/ldblib.c
    lua/liolib.c
    lua/lmathlib.c
    lua/loslib.c
    lua/lbitlib.c
    lua/lcorolib.c
    lua/loadlib.c
)

if(LINUX)
    set_target_properties(odin PROPERTIES LINK_FLAGS "-Wl,-rpath,$ORIGIN")
    # !!! FIXME: other stuff.
endif()

# end of CMakeLists.txt ...