source: trunk/CMakeLists.txt@ 107

Last change on this file since 107 was 107, checked in by smurzch2, 11 years ago

Add install targets to the cmake build system.

File size: 4.5 KB
Line 
1project (OSCam C)
2
3cmake_minimum_required (VERSION 2.6)
4
5#----------------------- detect system ------------------------------
6
7if (CMAKE_CROSSCOMPILING)
8 if (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
9 set (OSCamOperatingSystem "Tuxbox")
10 elseif (OSCAM_SYSTEM_NAME MATCHES "Fonera2")
11 set (OSCamOperatingSystem "Fonera2")
12 elseif (OSCAM_SYSTEM_NAME MATCHES "Amino")
13 set (OSCamOperatingSystem "Amino")
14 else (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
15 set (OSCamOperatingSystem "Unknown")
16 endif (OSCAM_SYSTEM_NAME MATCHES "Tuxbox")
17else (CMAKE_CROSSCOMPILING)
18 if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
19 set (OSCamOperatingSystem "Linux")
20 elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
21 set (OSCamOperatingSystem "Mac OS X")
22 else (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
23 set (OSCamOperatingSystem "Unknown")
24 endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
25endif (CMAKE_CROSSCOMPILING)
26
27#----------------------- some paths ------------------------------
28
29set (OPTIONAL_LINK_DIR "" CACHE STRING "Some optional link directories")
30set (OPTIONAL_INCLUDE_DIR "" CACHE STRING "Some optional include directories")
31
32include_directories (
33 ${CMAKE_CURRENT_SOURCE_DIR}/csctapi
34 ${CMAKE_CURRENT_SOURCE_DIR}/cscrypt
35 ${OPTIONAL_INCLUDE_DIR}
36 )
37link_directories (${OPTIONAL_LINK_DIR})
38
39#----------------------- global options ------------------------------
40
41set (CS_CONFDIR "/usr/local/etc" CACHE STRING "Default path for the config files")
42add_definitions ("-DCS_CONFDIR=\"${CS_CONFDIR}\"")
43
44if (OSCamOperatingSystem MATCHES "Linux")
45 add_definitions ("-DOS_LINUX")
46elseif (OSCamOperatingSystem MATCHES "Mac OS X")
47 add_definitions ("-DOS_MACOSX -DNEED_DAEMON -DCS_NOSHM -DHAVE_PTHREAD_H -DUSE_PTHREAD")
48elseif (OSCamOperatingSystem MATCHES "Tuxbox")
49 add_definitions ("-DOS_LINUX -DTUXBOX -DPPC")
50elseif (OSCamOperatingSystem MATCHES "Fonera2")
51 add_definitions ("-DOS_LINUX -DMIPSEL -DUCLIBC")
52elseif (OSCamOperatingSystem MATCHES "Amino")
53 add_definitions ("-DOS_LINUX")
54endif (OSCamOperatingSystem MATCHES "Linux")
55
56#----------------------- subdirectories ------------------------------
57
58add_subdirectory (csctapi)
59add_subdirectory (cscrypt)
60
61#----------------------- file groups ------------------------------
62
63file (GLOB csmodules_srcs "module-*.c")
64file (GLOB csmodules_hdrs "module-*.h")
65file (GLOB csreaders_srcs "reader-*.c")
66file (GLOB csreaders_hdrs "reader-*.h")
67file (GLOB csoscam_srcs "oscam-*.c")
68file (GLOB csoscam_hdrs "oscam-*.h")
69file (GLOB exe_srcs "oscam.c")
70file (GLOB exe_hdrs "globals.h")
71file (GLOB all_srcs ${csmodules_srcs} ${csreaders_srcs} ${csoscam_srcs} ${exe_srcs})
72
73#----------------------- modules ------------------------------
74
75set (csmodules "csmodules")
76add_library (${csmodules} STATIC ${csmodules_srcs} ${csmodules_hdrs})
77
78#----------------------- readers ------------------------------
79
80set (csreaders "csreaders")
81add_library (${csreaders} STATIC ${csreaders_srcs} ${csreaders_hdrs})
82
83#----------------------- other oscam files ------------------------------
84
85set (csoscam "csoscam")
86add_library (${csoscam} STATIC ${csoscam_srcs} ${csoscam_hdrs})
87
88#----------------------- the executable ------------------------------
89
90set (exe_name "oscam")
91add_executable (${exe_name} ${exe_srcs} ${exe_hdrs})
92target_link_libraries (${exe_name} crypto pthread ${csoscam} ${csmodules} ${csreaders} csctapi cscrypt)
93add_dependencies (${exe_name} ${csoscam} ${csreaders} ${csmodules})
94
95#----------------------- specific options ------------------------------
96
97if (OSCamOperatingSystem MATCHES "Linux")
98elseif (OSCamOperatingSystem MATCHES "Mac OS X")
99elseif (OSCamOperatingSystem MATCHES "Tuxbox")
100 target_link_libraries ( ${exe_name} dl)
101elseif (OSCamOperatingSystem MATCHES "Fonera2")
102elseif (OSCamOperatingSystem MATCHES "Amino")
103endif (OSCamOperatingSystem MATCHES "Linux")
104
105set_source_files_properties (${all_srcs} PROPERTIES COMPILE_FLAGS "-O3 -Winline -Werror -finline-functions -fomit-frame-pointer")
106
107#----------------------- installation -----------------------------
108
109file (GLOB config_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/oscam.*")
110file (GLOB doc_files "${CMAKE_CURRENT_SOURCE_DIR}/Distribution/doc/*.txt")
111
112install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${exe_name} DESTINATION bin COMPONENT bin)
113install (FILES ${config_files} DESTINATION etc COMPONENT config)
114install (FILES ${doc_files} DESTINATION share/doc/oscam COMPONENT doc)
115
116#----------------------- printout resume -----------------------------
117
118message (STATUS "")
119message (STATUS " operating system: ${OSCamOperatingSystem}")
120message (STATUS "")
Note: See TracBrowser for help on using the repository browser.