Another small update to pywwwget.
[PyMotherless.git] / CMakeLists.txt
blob2aec40862f74c04533b006064f0faa0eba733f26
1 project(PyMotherless NONE)
2 cmake_minimum_required(VERSION 2.8)
4 find_package(PythonInterp REQUIRED)
6 add_custom_target(build ALL
7     COMMAND ${PYTHON_EXECUTABLE} setup.py build --build-base ${CMAKE_BINARY_DIR}
8     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
9     )
11 # DESTDIR may be set at install time (eg: `make DESTDIR=/tmp/package install`)
12 # so we need to check for it when the install code is run and pass the appropriate
13 # argument to distutils.
15 # Note that if(\$ENV{DESTDIR}) always fails, regardless of the value of the DESTDIR
16 # environment variable, hence the STREQUAL test.
17 # See http://public.kitware.com/Bug/view.php?id=14737
18 install(CODE
19     "set(_root_arg)
20      if (NOT \$ENV{DESTDIR} STREQUAL \"\")
21          set(_root_arg --root \$ENV{DESTDIR})
22      endif()
23      execute_process(
24         COMMAND ${PYTHON_EXECUTABLE} setup.py install --prefix ${CMAKE_INSTALL_PREFIX} \${_root_arg}
25         WORKING_DIRECTORY \"${CMAKE_SOURCE_DIR}\"
26         )"
27     )