This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/cmake/Prelims.cmake

180 lines
3.8 KiB
CMake
Raw Normal View History

2016-07-31 17:35:57 +01:00
#begining stuff for top CMakeLists
include (MacroLogFeature)
2016-08-05 22:36:26 +01:00
if (POLICY CMP0042)
2016-09-09 04:21:15 +01:00
cmake_policy( SET CMP0042 NEW)
2016-08-05 22:36:26 +01:00
endif()
2016-07-31 17:35:57 +01:00
if (ANDROID)
2016-09-09 04:21:15 +01:00
macro ( MY_add_custom_target)
endmacro()
2016-07-31 17:35:57 +01:00
else()
macro ( MY_add_custom_target )
2016-09-09 04:21:15 +01:00
add_custom_target (${ARGN})
endmacro()
2016-07-31 17:35:57 +01:00
endif()
if (ANDROID)
2016-09-09 04:21:15 +01:00
macro ( add_component arg1)
foreach(item ${ARGN})
get_filename_component(i ${item} ABSOLUTE)
set( ALL_SOURCES ${ALL_SOURCES} ${i} )
endforeach()
set( ALL_SOURCES ${ALL_SOURCES} PARENT_SCOPE )
endmacro()
macro ( add_external arg1)
foreach(item ${ARGN})
get_filename_component(i ${item} ABSOLUTE)
set( ALL_SOURCES ${ALL_SOURCES} ${i} )
endforeach()
set( ALL_SOURCES ${ALL_SOURCES} PARENT_SCOPE )
endmacro()
2016-07-31 17:35:57 +01:00
else()
macro ( add_component arg1 )
2016-09-09 04:21:15 +01:00
add_library ( ${arg1} OBJECT ${ARGN})
endmacro()
2016-07-31 17:35:57 +01:00
macro ( add_external arg1 )
2016-09-09 04:21:15 +01:00
add_library ( ${arg1} SHARED ${ARGN})
endmacro()
2016-07-31 17:35:57 +01:00
endif()
if (ANDROID)
2016-09-09 04:21:15 +01:00
macro ( MY_add_dependencies)
endmacro()
2016-07-31 17:35:57 +01:00
else()
macro ( MY_add_dependencies )
2016-09-09 04:21:15 +01:00
add_dependencies (${ARGN})
endmacro()
2016-07-31 17:35:57 +01:00
endif()
if (ANDROID)
2016-09-09 04:21:15 +01:00
macro ( MY_add_library)
endmacro()
2016-07-31 17:35:57 +01:00
else()
macro ( MY_add_library )
2016-09-09 04:21:15 +01:00
add_library (${ARGN})
endmacro()
2016-07-31 17:35:57 +01:00
endif()
if (ANDROID)
2016-09-09 04:21:15 +01:00
macro ( MY_add_subdirectory)
endmacro()
2016-07-31 17:35:57 +01:00
else()
macro ( MY_add_subdirectory )
2016-09-09 04:21:15 +01:00
add_subdirectory (${ARGN})
endmacro()
2016-07-31 17:35:57 +01:00
endif()
if (ANDROID)
2016-09-09 04:21:15 +01:00
macro ( MY_include)
endmacro()
2016-07-31 17:35:57 +01:00
else()
macro ( MY_include )
2016-09-09 04:21:15 +01:00
include (${ARGN})
endmacro()
2016-07-31 17:35:57 +01:00
endif()
if (ANDROID)
2016-09-09 04:21:15 +01:00
macro ( MY_install)
endmacro()
2016-07-31 17:35:57 +01:00
else()
macro ( MY_install )
2016-09-09 04:21:15 +01:00
install (${ARGN})
endmacro()
2016-07-31 17:35:57 +01:00
endif()
if (ANDROID)
2016-09-09 04:21:15 +01:00
macro ( MY_set_target_properties)
endmacro()
2016-07-31 17:35:57 +01:00
else()
macro ( MY_set_target_properties )
2016-09-09 04:21:15 +01:00
set_target_properties (${ARGN})
endmacro()
2016-07-31 17:35:57 +01:00
endif()
if (ANDROID)
2016-09-09 04:21:15 +01:00
macro ( MY_target_link_libraries)
endmacro()
2016-07-31 17:35:57 +01:00
else()
macro ( MY_target_link_libraries )
2016-09-09 04:21:15 +01:00
target_link_libraries (${ARGN})
endmacro()
2016-07-31 17:35:57 +01:00
endif()
# where we have most scripts
# set path to additional CMake modules
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(disallow)
disallow_intree_builds()
# set(CMAKE_BUILD_TYPE Debug)
if (APPLE)
2016-09-09 04:21:15 +01:00
set (MACOSX_RPATH ON)
2016-07-31 17:35:57 +01:00
endif (APPLE )
if(POLICY CMP0042)
2016-09-09 04:21:15 +01:00
cmake_policy(SET CMP0042 NEW)
2016-07-31 17:35:57 +01:00
endif(POLICY CMP0042)
if(POLICY CMP0043)
2016-09-09 04:21:15 +01:00
cmake_policy(SET CMP0043 NEW)
2016-07-31 17:35:57 +01:00
endif(POLICY CMP0043)
2016-09-09 04:21:15 +01:00
if (ANDROID)
2016-11-24 04:35:39 +00:00
set ( prefix ${YAP_APP_DIR}/build )
set ( datarootdir ${prefix}/assets )
2016-09-09 04:21:15 +01:00
else()
2016-11-08 07:37:36 +00:00
set ( prefix "${CMAKE_INSTALL_PREFIX}")
2016-11-16 23:15:12 +00:00
set ( datarootdir ${prefix}/share )
2016-09-09 04:21:15 +01:00
endif()
2016-11-24 04:35:39 +00:00
set ( libpl ${datarootdir}/Yap)
2016-11-16 23:15:12 +00:00
set ( includedir "${prefix}/include")
2016-11-08 07:37:36 +00:00
set ( exec_prefix "${prefix}")
set ( libdir "${exec_prefix}/lib")
2016-07-31 17:35:57 +01:00
set ( datadir "${datarootdir}")
set ( mandir "${datarootdir}/man")
set ( bindir "${exec_prefix}/bin")
2016-11-24 04:35:39 +00:00
set ( docdir "${datarootdir}/doc/Yap")
set ( dlls "${exec_prefix}/lib/Yap")
2016-07-31 17:35:57 +01:00
set(YAP_ROOTDIR ${prefix})
# erootdir -> rootdir
# bindir defined above
# libdir defined above
set(YAP_LIBDIR "${dlls}")
set(YAP_SHAREDIR "${datarootdir}")
set(YAP_BINDIR "${bindir}")
set(YAP_INCLUDEDIR "${includedir}")
set(YAP_ROOTDIR "${prefix}")
#
#
# include( Sources NO_POLICY_SCOPE )
#
# include( Model NO_POLICY_SCOPE )
2016-10-16 23:18:51 +01:00
include (cudd NO-POLICY-SCOPE)
include (java NO-POLICY-SCOPE)
2017-05-02 07:41:55 +01:00
set (pl_library "" CACHE INTERNAL "prolog library files" )
set (pl_os_library "" CACHE INTERNAL "prolog os files" )
set (pl_boot_library "" CACHE INTERNAL "prolog boot files" )
function(add_to_group output list)
set (result "")
foreach (path IN LISTS ${list})
get_source_file_property(result ${path} LOCATION)
list( APPEND tmp ${result})
endforeach ()
list( APPEND ${output} ${tmp})
set (${output} ${${output}} CACHE INTERNAL "prolog library files")
endfunction(add_to_group output list )