GetCIMppSubmodule.cmake 1.39 KB
Newer Older
1
2
# Workaround for cimpp on Windows and as submodule

Markus Mirz's avatar
Markus Mirz committed
3
if(NOT CIM_VERSION)
Markus Mirz's avatar
Markus Mirz committed
4
	set(CIM_VERSION "CGMES_2.4.15_16FEB2016")
Markus Mirz's avatar
Markus Mirz committed
5
6
7
8
9
10
11
12
13
14
15
endif()

message(STATUS "CIM Version: ${CIM_VERSION}")

if(CIM_VERSION STREQUAL "16v29a")
	set(USE_CIM_VERSION "IEC61970_16v29a")
endif()
if(CIM_VERSION STREQUAL "CGMES_2.4.15_16FEB2016")
	set(USE_CIM_VERSION "CGMES_2.4.15_16FEB2016")
  set(CGMES_BUILD ON)
endif()
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

include(FetchContent)
FetchContent_Declare(
  cimpp-submodule
  GIT_REPOSITORY https://github.com/cim-iec/libcimpp.git
  GIT_TAG        master
)

FetchContent_GetProperties(cimpp-submodule)
if(NOT cimpp-submodule_POPULATED)
  FetchContent_Populate(cimpp-submodule)
endif()

FetchContent_GetProperties(cimpp-submodule)
message(STATUS "Path to cimpp-submodule: " ${cimpp-submodule_SOURCE_DIR})

if(NOT WIN32)
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()

# When adding CIMpp via a subdirectory, all the neccessary
# details about include directories, library name and path
# are associated with the CIMpp target 'libcimpp'
# We do not need to keep track of CIMPP_INCLUDE_DIR.
add_subdirectory(${cimpp-submodule_SOURCE_DIR} ${cimpp-submodule_BINARY_DIR})
set(CIMPP_LIBRARY libcimpp)
set(CIMPP_LIBRARIES ${CIMPP_LIBRARY})
set(CIMPP_INCLUDE_DIR "")

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CIMpp DEFAULT_MSG CIMPP_LIBRARY)

Markus Mirz's avatar
Markus Mirz committed
48
49
set(CIMPP_LIBRARIES ${CIMPP_LIBRARY})
set(CIMPP_INCLUDE_DIRS ${CIMPP_INCLUDE_DIR})