moved some parts from bash script already

This commit is contained in:
Eric Berberich 2012-01-25 13:16:52 +00:00
parent 7cb739f3e9
commit 640a4e6cb4
2 changed files with 101 additions and 2 deletions

View File

@ -31,3 +31,7 @@
# EBEB: For some reason, using "$@" only pushes the first word to cmake # EBEB: For some reason, using "$@" only pushes the first word to cmake
cmake -DOPTIONS:STRING="$1 $2 $3 $4 $5 $6" -P cgal_generate_cmake_script.cmake cmake -DOPTIONS:STRING="$1 $2 $3 $4 $5 $6" -P cgal_generate_cmake_script.cmake
echo "------------------------ OUTPUT -------------------------"
cat CMakeLists.txt

View File

@ -25,4 +25,99 @@ cmake_minimum_required(VERSION 2.6.2)
message(STATUS "Create CMakeLists.txt") message(STATUS "Create CMakeLists.txt")
message(STATUS "Repeat command line options: ${OPTIONS}") # message(STATUS "Repeat command line options: ${OPTIONS}")
set(PROJECT CGAL) #`basename $PWD`
set(SINGLE_SOURCE "")
set(CGAL_COMPONENTS "QT4 GMP MPFR RS3")
set(WITH_QT3 FALSE)
set(WITH_QT4 FALSE)
set(WITH_ALL_PRECONFIGURED_LIBS TRUE)
set(BOOST_COMPONENTS "")
# TODO enable_testing()?
### Delete file if it exists
if (EXISTS CMakeLists.txt)
file(RENAME CMakeLists.txt CMakeLists.bak)
endif()
### Parse options
# TODO
#-s
#-c/-p
#-b
#-t? # for testing
### Start to write file
file(APPEND CMakeLists.txt "# Created by the script cgal_generate_cmake_script\n" )
file(APPEND CMakeLists.txt "# This is the CMake script for compiling a set of CGAL applications.\n\n" )
if ( "${SINGLE_SOURCE}" STREQUAL "" )
file(APPEND CMakeLists.txt "project(${PROJECT})\n\n")
else()
file(APPEND CMakeLists.txt "project(${SINGLE_SOURCE})\n\n")
endif()
file(APPEND CMakeLists.txt
"cmake_minimum_required(VERSION 2.6.2)
if(\"\${CMAKE_MAJOR_VERSION}.\${CMAKE_MINOR_VERSION}\" VERSION_GREATER 2.6)
if(\"\${CMAKE_MAJOR_VERSION}.\${CMAKE_MINOR_VERSION}.\${CMAKE_PATCH_VERSION}\" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
endif()
set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true )
if ( COMMAND cmake_policy )
cmake_policy( SET CMP0003 NEW )
endif()
# CGAL and its components
")
# TODO testing?
#if [ -n "$ENABLE_CTEST" ]; then
# echo "enable_testing()"
#fi
# TODO case of components,
foreach( component ${CGAL_COMPONENTS})
# detect qt3, qt4, and ALL_PRECONFIGURED_LIBS
if ( ${component} STREQUAL "Qt3" )
set(WITH_QT3 TRUE)
endif()
if ( ${component} STREQUAL "Qt4" )
set(WITH_QT4 TRUE)
endif()
endforeach()
if ( WITH_ALL_PRECONFIGURED_LIBS )
set(CGAL_COMPONENTS "${CGAL_COMPONENTS} ALL_PRECONFIGURED_LIBS")
endif()
file(APPEND CMakeLists.txt "find_package( CGAL QUIET COMPONENTS ${CGAL_COMPONENTS} )\n\n")
file(APPEND CMakeLists.txt
"if ( NOT CGAL_FOUND )
message(STATUS \"This project requires the CGAL library, and will not be compiled.\")
return()
endif()
# include helper file
include( \${CGAL_USE_FILE} )
")