Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CMakeLists.txt #875

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ endif()
# https://docs.conan.io/en/latest/howtos/cmake_launch.html
# -----------------------------------------------------------------

if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/conan.cmake")
message(
STATUS
"Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(
DOWNLOAD
"https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake")
"${CMAKE_CURRENT_BINARY_DIR}/conan.cmake")
endif()

include(${CMAKE_BINARY_DIR}/conan.cmake)
include(${CMAKE_CURRENT_BINARY_DIR}/conan.cmake)

if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# set(conan_opts ...)
Expand Down Expand Up @@ -104,7 +104,8 @@ else()

if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} "--git-dir=${CMAKE_SOURCE_DIR}/.git" status
COMMAND ${GIT_EXECUTABLE} "--git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git"
status
RESULT_VARIABLE RESULT
OUTPUT_QUIET ERROR_QUIET)

Expand All @@ -115,20 +116,20 @@ else()

if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} "--git-dir=${CMAKE_SOURCE_DIR}/.git" rev-parse
HEAD
COMMAND ${GIT_EXECUTABLE} "--git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git"
rev-parse HEAD
OUTPUT_VARIABLE GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process(
COMMAND ${GIT_EXECUTABLE} "--git-dir=${CMAKE_SOURCE_DIR}/.git" rev-parse
--short HEAD
COMMAND ${GIT_EXECUTABLE} "--git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git"
rev-parse --short HEAD
OUTPUT_VARIABLE GIT_COMMIT_SHORT
OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process(
COMMAND ${GIT_EXECUTABLE} "--git-dir=${CMAKE_SOURCE_DIR}/.git" describe
--tags
COMMAND ${GIT_EXECUTABLE} "--git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git"
describe --tags
OUTPUT_VARIABLE GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE)

Expand Down Expand Up @@ -175,7 +176,7 @@ if(EXISTS ${EQUINOR_TESTDATA_ROOT})
"${EQUINOR_TESTDATA_ROOT}" "${LINK}")
message(STATUS "Linking testdata: ${LINK} -> ${EQUINOR_TESTDATA_ROOT}")

set(_equinor_test_data ${CMAKE_SOURCE_DIR}/test-data/Equinor)
set(_equinor_test_data ${CMAKE_CURRENT_SOURCE_DIR}/test-data/Equinor)
set(_eclpath ${_equinor_test_data}/ECLIPSE)
set(_geopath ${_equinor_test_data}/Geometry)
endif()
Expand Down Expand Up @@ -355,7 +356,7 @@ test_big_endian(BIG_ENDIAN)

check_type_size(time_t SIZE_OF_TIME_T)
if(${SIZE_OF_TIME_T} EQUAL 8)
try_run(RUN_RESULT COMPILE_RESULT ${CMAKE_BINARY_DIR}
try_run(RUN_RESULT COMPILE_RESULT ${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/cmake/Tests/test_mktime_before1970.c)
if(${COMPILE_RESULT})
if(${RUN_RESULT} EQUAL 0)
Expand All @@ -364,26 +365,26 @@ if(${SIZE_OF_TIME_T} EQUAL 8)
endif()
endif()

try_compile(HAVE_VA_COPY ${CMAKE_BINARY_DIR}
try_compile(HAVE_VA_COPY ${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/cmake/Tests/test_va_copy.c)
try_compile(HAVE_SIGBUS ${CMAKE_BINARY_DIR}
try_compile(HAVE_SIGBUS ${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/cmake/Tests/test_have_sigbus.c)
try_compile(HAVE_PID_T ${CMAKE_BINARY_DIR}
try_compile(HAVE_PID_T ${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/cmake/Tests/test_pid_t.c)
try_compile(HAVE_MODE_T ${CMAKE_BINARY_DIR}
try_compile(HAVE_MODE_T ${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/cmake/Tests/test_mode_t.c)
try_compile(ERT_HAVE_ISFINITE ${CMAKE_BINARY_DIR}
try_compile(ERT_HAVE_ISFINITE ${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/cmake/Tests/test_isfinite.c)
try_compile(HAVE_SIGHANDLER_T ${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/cmake/Tests/test_have_sighandler.c)

if(ERT_HAVE_READLINKAT)
try_compile(ERT_HAVE_READLINKAT_DECLARATION ${CMAKE_BINARY_DIR}
try_compile(ERT_HAVE_READLINKAT_DECLARATION ${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/cmake/Tests/test_have_readlinkat_decl.c)
endif()

set(BUILD_CXX ON)
try_compile(HAVE_CXX_SHARED_PTR ${CMAKE_BINARY_DIR}
try_compile(HAVE_CXX_SHARED_PTR ${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/cmake/Tests/test_shared_ptr.cpp)
if(NOT HAVE_CXX_SHARED_PTR)
set(BUILD_CXX OFF)
Expand All @@ -399,13 +400,13 @@ find_package(Git)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_SHORT
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
Expand Down