CMakeLists.txt
author Ryan C. Gordon <icculus@icculus.org>
Thu, 19 Dec 2013 23:04:04 -0500
changeset 10 85496558f3a4
parent 0 d7ee4e2ed49d
child 14 f359fb8eec3c
permissions -rw-r--r--
Patched to compile on Linux.
icculus@0
     1
cmake_minimum_required(VERSION 2.8.10)
icculus@0
     2
project(1pass)
icculus@0
     3
icculus@0
     4
# Set up some sanity stuff...
icculus@0
     5
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
icculus@0
     6
    SET(LINUX TRUE)
icculus@0
     7
endif()
icculus@0
     8
if(APPLE)
icculus@0
     9
    SET(MACOSX TRUE)
icculus@0
    10
endif()
icculus@0
    11
if(MSVC)
icculus@0
    12
    SET(WINDOWS TRUE)
icculus@0
    13
endif()
icculus@0
    14
icculus@0
    15
if(NOT CMAKE_BUILD_TYPE)
icculus@0
    16
    set(CMAKE_BUILD_TYPE Debug CACHE STRING "None Debug Release RelWithDebInfo MinSizeRel" FORCE)
icculus@0
    17
endif()
icculus@0
    18
SET(DEBUG FALSE)
icculus@0
    19
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
icculus@0
    20
    SET(DEBUG TRUE)
icculus@0
    21
endif()
icculus@0
    22
icculus@0
    23
icculus@0
    24
add_definitions(-D_REENTRANT=1)
icculus@0
    25
icculus@0
    26
if(DEBUG)
icculus@0
    27
    add_definitions(-DDEBUG=1)
icculus@0
    28
    add_definitions(-D_DEBUG=1)
icculus@0
    29
else()
icculus@0
    30
    add_definitions(-DNDEBUG=1)
icculus@0
    31
    add_definitions(-D_NDEBUG=1)
icculus@0
    32
endif()
icculus@0
    33
icculus@0
    34
if(WINDOWS)
icculus@0
    35
    add_definitions(-DWIN32=1)
icculus@0
    36
    add_definitions(-DOS_WIN32=1)
icculus@0
    37
    add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
icculus@0
    38
    add_definitions(-D_CRT_SECURE_NO_DEPRECATE=1)
icculus@0
    39
endif()
icculus@0
    40
icculus@0
    41
if(LINUX)
icculus@0
    42
    set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
icculus@0
    43
    add_definitions(-D_FILE_OFFSET_BITS=64)
icculus@0
    44
    add_definitions(-D_LARGEFILE_SOURCE=1)
icculus@0
    45
endif()
icculus@0
    46
icculus@0
    47
if(LINUX OR MACOSX)
icculus@0
    48
    if(DEBUG)
icculus@0
    49
        add_definitions(-O0 -ggdb3)
icculus@0
    50
    endif(DEBUG)
icculus@0
    51
    add_definitions(-pipe -fsigned-char)
icculus@0
    52
    set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}" CACHE STRING "compile flags" FORCE)
icculus@0
    53
icculus@0
    54
    add_definitions(-DLUA_USE_MKSTEMP=1)  # as opposed to tmpnam(), yuck!
icculus@0
    55
    add_definitions(-DLUA_USE_ULONGJMP=1)
icculus@0
    56
endif()
icculus@0
    57
icculus@0
    58
icculus@0
    59
include(TestBigEndian)
icculus@0
    60
test_big_endian(ONEPASS_IS_BIGENDIAN)
icculus@0
    61
if(ONEPASS_IS_BIGENDIAN)
icculus@0
    62
    add_definitions(-DPLATFORM_BIGENDIAN=1)
icculus@0
    63
else()
icculus@0
    64
    add_definitions(-DPLATFORM_LITTLEENDIAN=1)
icculus@0
    65
endif()
icculus@0
    66
icculus@0
    67
icculus@0
    68
include_directories("lua")
icculus@0
    69
icculus@0
    70
add_executable(1pass
icculus@0
    71
    1pass.c
icculus@0
    72
    pkcs5_pbkdf2.c
icculus@0
    73
    aes.c
icculus@0
    74
    md5.c
icculus@0
    75
    sha1.c
icculus@0
    76
    base64.c
icculus@0
    77
    lua/lapi.c
icculus@0
    78
    lua/ldebug.c
icculus@0
    79
    lua/ldo.c
icculus@0
    80
    lua/ldump.c
icculus@0
    81
    lua/lfunc.c
icculus@0
    82
    lua/lgc.c
icculus@0
    83
    lua/lmem.c
icculus@0
    84
    lua/lobject.c
icculus@0
    85
    lua/lopcodes.c
icculus@0
    86
    lua/lstate.c
icculus@0
    87
    lua/lstring.c
icculus@0
    88
    lua/ltable.c
icculus@0
    89
    lua/ltm.c
icculus@0
    90
    lua/lundump.c
icculus@0
    91
    lua/lvm.c
icculus@0
    92
    lua/lzio.c
icculus@0
    93
    lua/lauxlib.c
icculus@0
    94
    lua/lbaselib.c
icculus@0
    95
    lua/lstrlib.c
icculus@0
    96
    lua/ltablib.c
icculus@0
    97
    lua/lctype.c
icculus@0
    98
    lua/lparser.c
icculus@0
    99
    lua/llex.c
icculus@0
   100
    lua/lcode.c
icculus@0
   101
    lua/linit.c
icculus@0
   102
    lua/lctype.c
icculus@0
   103
    lua/ldblib.c
icculus@0
   104
    lua/liolib.c
icculus@0
   105
    lua/lmathlib.c
icculus@0
   106
    lua/loslib.c
icculus@0
   107
    lua/lbitlib.c
icculus@0
   108
    lua/lcorolib.c
icculus@0
   109
    lua/loadlib.c
icculus@0
   110
)
icculus@0
   111
icculus@0
   112
if(LINUX)
icculus@10
   113
    set_target_properties(1pass PROPERTIES LINK_FLAGS "-Wl,-rpath,$ORIGIN")
icculus@0
   114
    # !!! FIXME: other stuff.
icculus@10
   115
    target_link_libraries(1pass "m")
icculus@0
   116
endif()
icculus@0
   117
icculus@0
   118
# end of CMakeLists.txt ...
icculus@0
   119