comparison CMakeLists.txt @ 7:ee50db043251

Cross-platform fixes.
author Eric Wing <ewing . public |-at-| gmail . com>
date Thu, 28 Oct 2010 02:33:05 -0700
parents 8cb13d89451a
children a71ed111a627
comparison
equal deleted inserted replaced
6:4b1048af7e55 7:ee50db043251
79 ENDIF(ENABLE_ALMIXER_THREADS) 79 ENDIF(ENABLE_ALMIXER_THREADS)
80 80
81 81
82 82
83 IF(WANTS_BUILD_SHARED_LIBRARY) 83 IF(WANTS_BUILD_SHARED_LIBRARY)
84 ADD_LIBRARY(ALMIXER_LIBRARY SHARED ${PUBLIC_HEADERS} ${ALMIXER_SOURCE} ${RESOURCE_FILES}) 84 #ADD_LIBRARY(ALmixer SHARED ${PUBLIC_HEADERS} ${ALMIXER_SOURCE} ${RESOURCE_FILES})
85 ADD_LIBRARY(ALmixer SHARED ${PUBLIC_HEADERS} ${ALMIXER_SOURCE})
85 ELSE(WANTS_BUILD_SHARED_LIBRARY) 86 ELSE(WANTS_BUILD_SHARED_LIBRARY)
86 ADD_LIBRARY(ALMIXER_LIBRARY STATIC ${PUBLIC_HEADERS} ${ALMIXER_SOURCE} ${RESOURCE_FILES}) 87 ADD_LIBRARY(ALmixer STATIC ${PUBLIC_HEADERS} ${ALMIXER_SOURCE} ${RESOURCE_FILES})
87 ENDIF(WANTS_BUILD_SHARED_LIBRARY) 88 ENDIF(WANTS_BUILD_SHARED_LIBRARY)
88 SET_TARGET_PROPERTIES(ALMIXER_LIBRARY PROPERTIES OUTPUT_NAME "ALmixer") 89 #SET_TARGET_PROPERTIES(ALmixer PROPERTIES OUTPUT_NAME "ALmixer")
89 90
90 # Set Dynamic Library and Framework properties 91 # Set Dynamic Library and Framework properties
91 IF(WANTS_BUILD_SHARED_LIBRARY AND WANTS_BUILD_FRAMEWORK) 92 IF(WANTS_BUILD_SHARED_LIBRARY AND WANTS_BUILD_FRAMEWORK)
92 93
93 SET_TARGET_PROPERTIES(ALMIXER_LIBRARY PROPERTIES 94 SET_TARGET_PROPERTIES(ALmixer PROPERTIES
94 FRAMEWORK TRUE 95 FRAMEWORK TRUE
95 FRAMEWORK_VERSION "${ALMIXER_FRAMEWORK_VERSION_NUMBER}" 96 FRAMEWORK_VERSION "${ALMIXER_FRAMEWORK_VERSION_NUMBER}"
96 # PRIVATE_HEADER "fooPrivate.h;fooBoth.h" 97 # PRIVATE_HEADER "fooPrivate.h;fooBoth.h"
97 PUBLIC_HEADER "${PUBLIC_HEADERS}" 98 PUBLIC_HEADER "${PUBLIC_HEADERS}"
98 RESOURCE "${RESOURCE_FILES}" 99 RESOURCE "${RESOURCE_FILES}"
103 # COMPILE_FLAGS "${ALMIXER_C_FLAGS}" 104 # COMPILE_FLAGS "${ALMIXER_C_FLAGS}"
104 ) 105 )
105 106
106 # I moved the INSTALL_NAME_DIR to use SET_PROPERTY instead because 107 # I moved the INSTALL_NAME_DIR to use SET_PROPERTY instead because
107 # SET_TARGET_PROPERTIES will fail if the variable is empty. 108 # SET_TARGET_PROPERTIES will fail if the variable is empty.
108 SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY INSTALL_NAME_DIR ${CMAKE_FRAMEWORK_INSTALL_NAME_DIR}) 109 SET_PROPERTY(TARGET ALmixer PROPERTY INSTALL_NAME_DIR ${CMAKE_FRAMEWORK_INSTALL_NAME_DIR})
109 SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY BUILD_WITH_INSTALL_RPATH NO) 110 SET_PROPERTY(TARGET ALmixer PROPERTY BUILD_WITH_INSTALL_RPATH NO)
110 # If the user deletes the install_name path, use the gcc default 111 # If the user deletes the install_name path, use the gcc default
111 # and disable the option completely. But CMake by default places 112 # and disable the option completely. But CMake by default places
112 # the name of the library in the install_name if 113 # the name of the library in the install_name if
113 # BUILD_WITH_INSTALL_RPATH is ON. So to avoid this, I need to 114 # BUILD_WITH_INSTALL_RPATH is ON. So to avoid this, I need to
114 # disable the switch. 115 # disable the switch.
115 IF(CMAKE_FRAMEWORK_INSTALL_NAME_DIR) 116 IF(CMAKE_FRAMEWORK_INSTALL_NAME_DIR)
116 # MESSAGE("got dir ${CMAKE_FRAMEWORK_INSTALL_NAME_DIR}") 117 # MESSAGE("got dir ${CMAKE_FRAMEWORK_INSTALL_NAME_DIR}")
117 SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY BUILD_WITH_INSTALL_RPATH ${CMAKE_BUILD_WITH_INSTALL_RPATH}) 118 SET_PROPERTY(TARGET ALmixer PROPERTY BUILD_WITH_INSTALL_RPATH ${CMAKE_BUILD_WITH_INSTALL_RPATH})
118 119
119 ELSE(CMAKE_FRAMEWORK_INSTALL_NAME_DIR) 120 ELSE(CMAKE_FRAMEWORK_INSTALL_NAME_DIR)
120 # MESSAGE("no dir ${CMAKE_FRAMEWORK_INSTALL_NAME_DIR}") 121 # MESSAGE("no dir ${CMAKE_FRAMEWORK_INSTALL_NAME_DIR}")
121 SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY BUILD_WITH_INSTALL_RPATH NO) 122 SET_PROPERTY(TARGET ALmixer PROPERTY BUILD_WITH_INSTALL_RPATH NO)
122 123
123 ENDIF(CMAKE_FRAMEWORK_INSTALL_NAME_DIR) 124 ENDIF(CMAKE_FRAMEWORK_INSTALL_NAME_DIR)
124 125
125 126
126 127
131 SET(MACOSX_FRAMEWORK_BUNDLE_VERSION "${ALMIXER_MAJOR_VERSION}.${ALMIXER_MINOR_VERSION}.${ALMIXER_PATCH_VERSION}") 132 SET(MACOSX_FRAMEWORK_BUNDLE_VERSION "${ALMIXER_MAJOR_VERSION}.${ALMIXER_MINOR_VERSION}.${ALMIXER_PATCH_VERSION}")
132 SET(MACOSX_FRAMEWORK_IDENTIFIER "net.playcontrol.almixer") 133 SET(MACOSX_FRAMEWORK_IDENTIFIER "net.playcontrol.almixer")
133 134
134 ELSEIF(WANTS_BUILD_SHARED_LIBRARY) 135 ELSEIF(WANTS_BUILD_SHARED_LIBRARY)
135 IF(APPLE) 136 IF(APPLE)
136 SET_TARGET_PROPERTIES(ALMIXER_LIBRARY PROPERTIES 137 SET_TARGET_PROPERTIES(ALmixer PROPERTIES
137 FRAMEWORK FALSE 138 FRAMEWORK FALSE
138 # INSTALL_NAME_DIR ${CMAKE_DYLIB_INSTALL_NAME_DIR} 139 # INSTALL_NAME_DIR ${CMAKE_DYLIB_INSTALL_NAME_DIR}
139 # BUILD_WITH_INSTALL_RPATH ${CMAKE_BUILD_WITH_INSTALL_RPATH} 140 # BUILD_WITH_INSTALL_RPATH ${CMAKE_BUILD_WITH_INSTALL_RPATH}
140 VERSION ${ALMIXER_VERSION} 141 VERSION ${ALMIXER_VERSION}
141 SOVERSION ${ALMIXER_COMPATIBILITY_VERSION} 142 SOVERSION ${ALMIXER_COMPATIBILITY_VERSION}
142 # COMPILE_FLAGS "${ALMIXER_C_FLAGS}" 143 # COMPILE_FLAGS "${ALMIXER_C_FLAGS}"
143 ) 144 )
144 # I moved the INSTALL_NAME_DIR to use SET_PROPERTY instead because 145 # I moved the INSTALL_NAME_DIR to use SET_PROPERTY instead because
145 # SET_TARGET_PROPERTIES will fail if the variable is empty. 146 # SET_TARGET_PROPERTIES will fail if the variable is empty.
146 SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY INSTALL_NAME_DIR ${CMAKE_DYLIB_INSTALL_NAME_DIR}) 147 SET_PROPERTY(TARGET ALmixer PROPERTY INSTALL_NAME_DIR ${CMAKE_DYLIB_INSTALL_NAME_DIR})
147 SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY BUILD_WITH_INSTALL_RPATH NO) 148 SET_PROPERTY(TARGET ALmixer PROPERTY BUILD_WITH_INSTALL_RPATH NO)
148 # If the user deletes the install_name path, use the gcc default 149 # If the user deletes the install_name path, use the gcc default
149 # and disable the option completely. But CMake by default places 150 # and disable the option completely. But CMake by default places
150 # the name of the library in the install_name if 151 # the name of the library in the install_name if
151 # BUILD_WITH_INSTALL_RPATH is ON. So to avoid this, I need to 152 # BUILD_WITH_INSTALL_RPATH is ON. So to avoid this, I need to
152 # disable the switch. 153 # disable the switch.
153 IF(CMAKE_DYLIB_INSTALL_NAME_DIR) 154 IF(CMAKE_DYLIB_INSTALL_NAME_DIR)
154 SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY BUILD_WITH_INSTALL_RPATH ${CMAKE_BUILD_WITH_INSTALL_RPATH}) 155 SET_PROPERTY(TARGET ALmixer PROPERTY BUILD_WITH_INSTALL_RPATH ${CMAKE_BUILD_WITH_INSTALL_RPATH})
155 ELSE(CMAKE_DYLIB_INSTALL_NAME_DIR) 156 ELSE(CMAKE_DYLIB_INSTALL_NAME_DIR)
156 SET_PROPERTY(TARGET ALMIXER_LIBRARY PROPERTY BUILD_WITH_INSTALL_RPATH OFF) 157 SET_PROPERTY(TARGET ALmixer PROPERTY BUILD_WITH_INSTALL_RPATH OFF)
157 ENDIF(CMAKE_DYLIB_INSTALL_NAME_DIR) 158 ENDIF(CMAKE_DYLIB_INSTALL_NAME_DIR)
158 159
159 160
160 161
161 ELSEIF(UNIX) 162 ELSEIF(UNIX)
162 SET_TARGET_PROPERTIES(ALMIXER_LIBRARY PROPERTIES 163 SET_TARGET_PROPERTIES(ALmixer PROPERTIES
163 INSTALL_RPATH ${CMAKE_INSTALL_RPATH} 164 INSTALL_RPATH ${CMAKE_INSTALL_RPATH}
164 BUILD_WITH_INSTALL_RPATH ${CMAKE_BUILD_WITH_INSTALL_RPATH} 165 BUILD_WITH_INSTALL_RPATH ${CMAKE_BUILD_WITH_INSTALL_RPATH}
165 VERSION ${ALMIXER_VERSION} 166 VERSION ${ALMIXER_VERSION}
166 SOVERSION ${ALMIXER_SOVERSION} 167 SOVERSION ${ALMIXER_SOVERSION}
167 # COMPILE_FLAGS "${ALMIXER_C_FLAGS}" 168 # COMPILE_FLAGS "${ALMIXER_C_FLAGS}"
168 ) 169 )
169 170
170 ELSEIF(WIN32) 171 ELSEIF(WIN32)
171 SET_TARGET_PROPERTIES(ALMIXER_LIBRARY PROPERTIES 172 MESSAGE("Win32")
172 VERSION ${ALMIXER_VERSION} 173 # SET_TARGET_PROPERTIES(ALmixer PROPERTIES
173 SOVERSION ${ALMIXER_COMPATIBILITY_VERSION} 174 # VERSION ${ALMIXER_VERSION}
174 # COMPILE_FLAGS "${ALMIXER_C_FLAGS} -DALMIXER_BUILD_AS_DLL" 175 # SOVERSION ${ALMIXER_COMPATIBILITY_VERSION}
175 ) 176 #)
176 177
177 ELSE(APPLE) 178 ELSE(APPLE)
178 SET_TARGET_PROPERTIES(ALMIXER_LIBRARY PROPERTIES 179 SET_TARGET_PROPERTIES(ALmixer PROPERTIES
179 VERSION ${ALMIXER_VERSION} 180 VERSION ${ALMIXER_VERSION}
180 SOVERSION ${ALMIXER_COMPATIBILITY_VERSION} 181 SOVERSION ${ALMIXER_COMPATIBILITY_VERSION}
181 # COMPILE_FLAGS "${ALMIXER_C_FLAGS}" 182 # COMPILE_FLAGS "${ALMIXER_C_FLAGS}"
182 ) 183 )
183 184
185 186
186 187
187 ENDIF(WANTS_BUILD_SHARED_LIBRARY AND WANTS_BUILD_FRAMEWORK) 188 ENDIF(WANTS_BUILD_SHARED_LIBRARY AND WANTS_BUILD_FRAMEWORK)
188 189
189 INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR} ${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) 190 INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR} ${SDL_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR})
190 TARGET_LINK_LIBRARIES(ALMIXER_LIBRARY ${OPENAL_LIBRARY} ${SDL_SOUND_LIBRARIES} ${SDL_LIBRARY}) 191 TARGET_LINK_LIBRARIES(ALmixer ${OPENAL_LIBRARY} ${SDL_SOUND_LIBRARIES} ${SDL_LIBRARY})
191 192
192 193
193 194
194 # For Doxygen 195 # For Doxygen
195 # This will find the Doxygen stuff on your system if you want it. 196 # This will find the Doxygen stuff on your system if you want it.
260 261
261 # Install commands below 262 # Install commands below
262 IF(APPLE AND WANTS_BUILD_SHARED_LIBRARY AND WANTS_BUILD_FRAMEWORK) 263 IF(APPLE AND WANTS_BUILD_SHARED_LIBRARY AND WANTS_BUILD_FRAMEWORK)
263 # Will install framework to /Library/Frameworks directory or user specified 264 # Will install framework to /Library/Frameworks directory or user specified
264 INSTALL(TARGETS 265 INSTALL(TARGETS
265 ALMIXER_LIBRARY 266 ALmixer
266 FRAMEWORK DESTINATION ${CMAKE_FRAMEWORK_INSTALL_DIR} 267 FRAMEWORK DESTINATION ${CMAKE_FRAMEWORK_INSTALL_DIR}
267 ) 268 )
268 ELSE(APPLE AND WANTS_BUILD_SHARED_LIBRARY AND WANTS_BUILD_FRAMEWORK) 269 ELSE(APPLE AND WANTS_BUILD_SHARED_LIBRARY AND WANTS_BUILD_FRAMEWORK)
269 INSTALL(TARGETS 270 INSTALL(TARGETS
270 ALMIXER_LIBRARY 271 ALmixer
271 LIBRARY DESTINATION lib 272 LIBRARY DESTINATION lib
272 ARCHIVE DESTINATION lib 273 ARCHIVE DESTINATION lib
273 PUBLIC_HEADER DESTINATION include 274 PUBLIC_HEADER DESTINATION include
274 ) 275 )
275 ENDIF(APPLE AND WANTS_BUILD_SHARED_LIBRARY AND WANTS_BUILD_FRAMEWORK) 276 ENDIF(APPLE AND WANTS_BUILD_SHARED_LIBRARY AND WANTS_BUILD_FRAMEWORK)