src/CMakeLists.txt
author Tero Marttila <terom@fixme.fi>
Thu, 22 Jan 2009 01:53:05 +0200
branchnew_graphics
changeset 417 c503e0c6a740
parent 412 721c60072091
child 422 5e4c8631779e
permissions -rw-r--r--
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
417
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
     1
FILE(GLOB SOURCE_FILES "*.cc")
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
     2
FILE(GLOB HEADER_FILES "*.hh")
0
c8174cf25e06 initial import
hrnt
parents:
diff changeset
     3
397
13fa0546ef87 hopefully version stuff is now run properly on every make...
Tero Marttila <terom@fixme.fi>
parents: 186
diff changeset
     4
set_source_files_properties("version.c" PROPERTIES GENERATED true)
0
c8174cf25e06 initial import
hrnt
parents:
diff changeset
     5
417
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
     6
# Component selection
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
     7
set (GRAPHICS_ENABLED true)
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
     8
set (NETWORK_ENABLED true)
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
     9
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    10
mark_as_advanced (CLEAR GRAPHICS_ENABLED NETWORK_ENABLED)
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    11
0
c8174cf25e06 initial import
hrnt
parents:
diff changeset
    12
# Generate config.h
c8174cf25e06 initial import
hrnt
parents:
diff changeset
    13
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY)
c8174cf25e06 initial import
hrnt
parents:
diff changeset
    14
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
c8174cf25e06 initial import
hrnt
parents:
diff changeset
    15
412
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    16
# main module
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    17
set (CORE_CLANLIB_COMPONENTS Core App Signals)
417
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    18
set (CORE_SOURCES ${SOURCE_FILES} ${HEADER_FILES} "version.c")
412
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    19
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    20
# Graphics module
417
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    21
if (GRAPHICS_ENABLED)
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    22
    add_subdirectory (Graphics)
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    23
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    24
endif (GRAPHICS_ENABLED)
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    25
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    26
# Network module
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    27
if (NETWORK_ENABLED)
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    28
    add_subdirectory (Network)
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    29
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    30
endif (NETWORK_ENABLED)    
412
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    31
0
c8174cf25e06 initial import
hrnt
parents:
diff changeset
    32
# Libraries
412
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    33
set (CLANLIB_VERSION 0.8)
417
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    34
set (CLANLIB_COMPONENTS ${CORE_CLANLIB_COMPONENTS} ${GRAPHICS_CLANLIB_COMPONENTS} ${NETWORK_CLANLIB_COMPONENTS})
0
c8174cf25e06 initial import
hrnt
parents:
diff changeset
    35
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents: 119
diff changeset
    36
# ClanLib 0.8
412
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    37
message (STATUS "Finding ClanLib version=${CLANLIB_VERSION}, components=${CLANLIB_COMPONENTS}" )
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    38
find_package(ClanLib ${CLANLIB_VERSION} REQUIRED COMPONENTS ${CLANLIB_COMPONENTS})
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    39
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents: 119
diff changeset
    40
include_directories(${ClanLib_INCLUDE_DIRS})
412
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    41
721c60072091 new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents: 411
diff changeset
    42
# build list of libs/source files
185
25becd2cb026 that's not a prototype anymore... at least it shouldn't be
terom
parents: 119
diff changeset
    43
set(LIBS ${LIBS} ${ClanLib_LIBRARIES})
417
c503e0c6a740 support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents: 412
diff changeset
    44
set(SOURCES ${CORE_SOURCES} ${GRAPHICS_SOURCES} ${NETWORK_SOURCES})
0
c8174cf25e06 initial import
hrnt
parents:
diff changeset
    45
c8174cf25e06 initial import
hrnt
parents:
diff changeset
    46
# Assumes the project generates only one executable. If you need more, you'll need to alter
c8174cf25e06 initial import
hrnt
parents:
diff changeset
    47
# the script and replace ${PROJECT_SHORT_NAME} by executable name.
c8174cf25e06 initial import
hrnt
parents:
diff changeset
    48
add_executable("${PROJECT_SHORT_NAME}" ${SOURCES})
c8174cf25e06 initial import
hrnt
parents:
diff changeset
    49
target_link_libraries("${PROJECT_SHORT_NAME}" ${LIBS})
c8174cf25e06 initial import
hrnt
parents:
diff changeset
    50
install(TARGETS "${PROJECT_SHORT_NAME}" DESTINATION bin)
c8174cf25e06 initial import
hrnt
parents:
diff changeset
    51
6
faa4e777cc6e fiddle with cmake, fix some compile errors
terom
parents: 0
diff changeset
    52