CMakeLists.txt
author Ryan C. Gordon <icculus@icculus.org>
Thu, 22 Nov 2012 12:39:53 -0500
changeset 108 0a4566740a98
parent 103 7528b40af909
permissions -rw-r--r--
Make this work on gcc2.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
252314f3526d Added basic CMakeLists.txt
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
252314f3526d Added basic CMakeLists.txt
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
PROJECT(FatELF)
252314f3526d Added basic CMakeLists.txt
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
49
67d4a1f66dd7 Added some version magic.
Ryan C. Gordon <icculus@icculus.org>
parents: 48
diff changeset
     4
EXECUTE_PROCESS(
67d4a1f66dd7 Added some version magic.
Ryan C. Gordon <icculus@icculus.org>
parents: 48
diff changeset
     5
    COMMAND hg tip --template hg-{rev}:{node|short}
67d4a1f66dd7 Added some version magic.
Ryan C. Gordon <icculus@icculus.org>
parents: 48
diff changeset
     6
    WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
67d4a1f66dd7 Added some version magic.
Ryan C. Gordon <icculus@icculus.org>
parents: 48
diff changeset
     7
    RESULT_VARIABLE HGVERSION_RC
67d4a1f66dd7 Added some version magic.
Ryan C. Gordon <icculus@icculus.org>
parents: 48
diff changeset
     8
    OUTPUT_VARIABLE FATELF_VERSION
67d4a1f66dd7 Added some version magic.
Ryan C. Gordon <icculus@icculus.org>
parents: 48
diff changeset
     9
    ERROR_QUIET
67d4a1f66dd7 Added some version magic.
Ryan C. Gordon <icculus@icculus.org>
parents: 48
diff changeset
    10
    OUTPUT_STRIP_TRAILING_WHITESPACE
67d4a1f66dd7 Added some version magic.
Ryan C. Gordon <icculus@icculus.org>
parents: 48
diff changeset
    11
)
67d4a1f66dd7 Added some version magic.
Ryan C. Gordon <icculus@icculus.org>
parents: 48
diff changeset
    12
103
7528b40af909 Cleaned up GCC compiler flags in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents: 55
diff changeset
    13
IF(CMAKE_COMPILER_IS_GNUCC)
7528b40af909 Cleaned up GCC compiler flags in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents: 55
diff changeset
    14
    ADD_DEFINITIONS(-pipe -fsigned-char -Wall -Werror)
7528b40af909 Cleaned up GCC compiler flags in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents: 55
diff changeset
    15
ENDIF(CMAKE_COMPILER_IS_GNUCC)
7528b40af909 Cleaned up GCC compiler flags in CMakeLists.txt.
Ryan C. Gordon <icculus@icculus.org>
parents: 55
diff changeset
    16
49
67d4a1f66dd7 Added some version magic.
Ryan C. Gordon <icculus@icculus.org>
parents: 48
diff changeset
    17
ADD_DEFINITIONS(-DAPPID=fatelf)
67d4a1f66dd7 Added some version magic.
Ryan C. Gordon <icculus@icculus.org>
parents: 48
diff changeset
    18
ADD_DEFINITIONS(-DAPPREV="${FATELF_VERSION}")
67d4a1f66dd7 Added some version magic.
Ryan C. Gordon <icculus@icculus.org>
parents: 48
diff changeset
    19
3
252314f3526d Added basic CMakeLists.txt
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
INCLUDE_DIRECTORIES(include)
6
bc87cbaa4e35 Cleaned up that #include nastiness.
Ryan C. Gordon <icculus@icculus.org>
parents: 3
diff changeset
    21
55
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    22
ADD_LIBRARY(fatelf-utils STATIC utils/fatelf-utils.c)
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    23
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    24
MACRO(ADD_FATELF_EXECUTABLE _NAME)
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    25
    ADD_EXECUTABLE(${_NAME} utils/${_NAME}.c)
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    26
    TARGET_LINK_LIBRARIES(${_NAME} fatelf-utils)
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    27
    INSTALL(TARGETS ${_NAME} RUNTIME DESTINATION bin)
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    28
ENDMACRO(ADD_FATELF_EXECUTABLE)
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    29
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    30
ADD_FATELF_EXECUTABLE(fatelf-glue)
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    31
ADD_FATELF_EXECUTABLE(fatelf-info)
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    32
ADD_FATELF_EXECUTABLE(fatelf-extract)
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    33
ADD_FATELF_EXECUTABLE(fatelf-replace)
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    34
ADD_FATELF_EXECUTABLE(fatelf-remove)
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    35
ADD_FATELF_EXECUTABLE(fatelf-verify)
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    36
ADD_FATELF_EXECUTABLE(fatelf-split)
4c824f0ba28c Build system: only build fatelf-utils.c once, add "make install" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 49
diff changeset
    37
ADD_FATELF_EXECUTABLE(fatelf-validate)
3
252314f3526d Added basic CMakeLists.txt
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    38
252314f3526d Added basic CMakeLists.txt
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    39
# end of CMakeLists.txt ...
252314f3526d Added basic CMakeLists.txt
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40