tools/CMakeLists.txt
author unc0rr
Thu, 26 Jul 2012 11:56:58 +0400
changeset 7446 9ce6e2c35413
parent 7112 38c5d56c4d6e
child 7817 6cc558a69b58
permissions -rw-r--r--
No more AI jumping lulz
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2593
dd995a9c8871 add an uninstall target (to be tested)
koda
parents: 2550
diff changeset
     1
if (NOT APPLE)
5169
e353ca78d28b some comments and simplifications for cmake files
koda
parents: 5096
diff changeset
     2
	configure_file(	"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
e353ca78d28b some comments and simplifications for cmake files
koda
parents: 5096
diff changeset
     3
			"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
e353ca78d28b some comments and simplifications for cmake files
koda
parents: 5096
diff changeset
     4
			IMMEDIATE @ONLY)
2593
dd995a9c8871 add an uninstall target (to be tested)
koda
parents: 2550
diff changeset
     5
5169
e353ca78d28b some comments and simplifications for cmake files
koda
parents: 5096
diff changeset
     6
	add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
2593
dd995a9c8871 add an uninstall target (to be tested)
koda
parents: 2550
diff changeset
     7
endif()
dd995a9c8871 add an uninstall target (to be tested)
koda
parents: 2550
diff changeset
     8
5053
a767954cfa03 this should help people hacking the cmake files
koda
parents: 4775
diff changeset
     9
if (APPLE)
2641
b08cafb86797 some tweaks in the mac compilation system
koda
parents: 2593
diff changeset
    10
	find_package(Qt4 REQUIRED)
b08cafb86797 some tweaks in the mac compilation system
koda
parents: 2593
diff changeset
    11
	find_package(SDL REQUIRED)
b08cafb86797 some tweaks in the mac compilation system
koda
parents: 2593
diff changeset
    12
	find_package(SDL_image REQUIRED)
b08cafb86797 some tweaks in the mac compilation system
koda
parents: 2593
diff changeset
    13
	find_package(SDL_net REQUIRED)
b08cafb86797 some tweaks in the mac compilation system
koda
parents: 2593
diff changeset
    14
	find_package(SDL_ttf REQUIRED)
b08cafb86797 some tweaks in the mac compilation system
koda
parents: 2593
diff changeset
    15
	find_package(SDL_mixer REQUIRED)
b08cafb86797 some tweaks in the mac compilation system
koda
parents: 2593
diff changeset
    16
	find_package(OGGVORBIS REQUIRED)
4775
663aa9552bfc add NOAUTOUPDATE symbol and hedgewars-server.cabal
koda
parents: 4341
diff changeset
    17
        if(NOT NOAUTOUPDATE)
5169
e353ca78d28b some comments and simplifications for cmake files
koda
parents: 5096
diff changeset
    18
		#needed for SPARKLE_FOUND variable
e353ca78d28b some comments and simplifications for cmake files
koda
parents: 5096
diff changeset
    19
		find_package(Sparkle QUIET)
5188
d0461bd6d45b some updates to the crossbuild system for mac
koda
parents: 5169
diff changeset
    20
		#needed because the 'if' clause in the script prints silly policy warnings
d0461bd6d45b some updates to the crossbuild system for mac
koda
parents: 5169
diff changeset
    21
		if(${SPARKLE_FOUND})
d0461bd6d45b some updates to the crossbuild system for mac
koda
parents: 5169
diff changeset
    22
			set(SPARKLE_FOUND 1)
d0461bd6d45b some updates to the crossbuild system for mac
koda
parents: 5169
diff changeset
    23
		else()
d0461bd6d45b some updates to the crossbuild system for mac
koda
parents: 5169
diff changeset
    24
			set(SPARKLE_FOUND 0)
d0461bd6d45b some updates to the crossbuild system for mac
koda
parents: 5169
diff changeset
    25
		endif()
4775
663aa9552bfc add NOAUTOUPDATE symbol and hedgewars-server.cabal
koda
parents: 4341
diff changeset
    26
	endif()
4335
c279aeb615df improve mac bundle creation
koda
parents: 2641
diff changeset
    27
c279aeb615df improve mac bundle creation
koda
parents: 2641
diff changeset
    28
	#use the associated tool from the libraries we've selected
4341
46b8791e577f minor things
koda
parents: 4335
diff changeset
    29
	string(REGEX REPLACE "(.*)/include.*" "\\1" qt_base_dir "${QT_INCLUDE_DIR}")
5169
e353ca78d28b some comments and simplifications for cmake files
koda
parents: 5096
diff changeset
    30
e353ca78d28b some comments and simplifications for cmake files
koda
parents: 5096
diff changeset
    31
	#remove the ";-framework Cocoa" from the SDL_LIBRARY variable
e353ca78d28b some comments and simplifications for cmake files
koda
parents: 5096
diff changeset
    32
	string(REGEX REPLACE "(.*);-.*" "\\1" sdl_dir "${SDL_LIBRARY}")
2219
07f5345ecae7 additional variable (BUNDLE) to make a standalone Mac application
koda
parents:
diff changeset
    33
5096
7d588baaff82 small tweak for bundle creation
koda
parents: 5053
diff changeset
    34
	#this tool is present in qt 4.5 but only if you compile from sources; from qt 4.6 is present also in the binary version
7112
38c5d56c4d6e rename a few internal cmake variables (for consistency and readability)
koda
parents: 6089
diff changeset
    35
	find_program(macdeployqt_executable NAMES macdeployqt macdeployqt-mac PATHS ${qt_base_dir}/bin)
38c5d56c4d6e rename a few internal cmake variables (for consistency and readability)
koda
parents: 6089
diff changeset
    36
	if(NOT macdeployqt_executable)
6089
adc69bbb24e5 (a lot of) ooops
koda
parents: 5188
diff changeset
    37
		message(FATAL_ERROR "The utility macdeployqt is required to create the bundle (seached: ${qt_base_dir})")
adc69bbb24e5 (a lot of) ooops
koda
parents: 5188
diff changeset
    38
	else()
7112
38c5d56c4d6e rename a few internal cmake variables (for consistency and readability)
koda
parents: 6089
diff changeset
    39
		message(STATUS "macdeployqt found in ${macdeployqt_executable}")
2641
b08cafb86797 some tweaks in the mac compilation system
koda
parents: 2593
diff changeset
    40
	endif()
2219
07f5345ecae7 additional variable (BUNDLE) to make a standalone Mac application
koda
parents:
diff changeset
    41
2641
b08cafb86797 some tweaks in the mac compilation system
koda
parents: 2593
diff changeset
    42
	#dummy target, we're interested in the postscript file
b08cafb86797 some tweaks in the mac compilation system
koda
parents: 2593
diff changeset
    43
	add_custom_target(bundle)
b08cafb86797 some tweaks in the mac compilation system
koda
parents: 2593
diff changeset
    44
	set_target_properties(bundle PROPERTIES POST_INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/CreateMacBundle.cmake)
2219
07f5345ecae7 additional variable (BUNDLE) to make a standalone Mac application
koda
parents:
diff changeset
    45
5169
e353ca78d28b some comments and simplifications for cmake files
koda
parents: 5096
diff changeset
    46
	configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CreateMacBundle.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/CreateMacBundle.cmake)
e353ca78d28b some comments and simplifications for cmake files
koda
parents: 5096
diff changeset
    47
endif()
2547
koda
parents: 2546
diff changeset
    48