2 #//===----------------------------------------------------------------------===//
4 #// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 #// See https://llvm.org/LICENSE.txt for license information.
6 #// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 #//===----------------------------------------------------------------------===//
12 cmake_minimum_required(VERSION 3.20.0)
14 add_library (ompd SHARED TargetValue.cpp omp-debug.cpp omp-state.cpp omp-icv.cpp)
16 # libompd must not link against libomp, there is no code dependency.
17 add_dependencies(ompd omp) # ensure generated import library is created first
19 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
21 set(LIBOMPD_LD_STD_FLAGS FALSE CACHE BOOL
22 "Use -stdlibc++ instead of -libc++ library for C++ ")
24 if(${LIBOMPD_LD_STD_FLAGS})
25 # Find and replace/add libstdc++ to compile flags
26 STRING( FIND "${CMAKE_CXX_FLAGS}" "-stdlib=libc++" OUT )
27 if("${OUT}" STREQUAL "-1" )
28 set (CMAKE_CXX_FLAGS "-stdlib=libstdc++ ${CMAKE_CXX_FLAGS}")
30 STRING( REPLACE "-stdlib=libc++" "-stdlib=libstdc++" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} )
33 # Find and replace/add libstdc++ to loader flags
34 STRING( FIND "${CMAKE_SHARED_LINKER_FLAGS}" "-stdlib=libc++" OUT )
35 if("${OUT}" STREQUAL "-1" )
36 set (CMAKE_SHARED_LINKER_FLAGS "-stdlib=libstdc++ ${CMAKE_SHARED_LINKER_FLAGS}")
38 STRING( REPLACE "-stdlib=libc++" "-stdlib=libstdc++" CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} )
43 ${CMAKE_CURRENT_SOURCE_DIR}
49 LIBRARY DESTINATION ${OPENMP_INSTALL_LIBDIR}
50 ARCHIVE DESTINATION ${OPENMP_INSTALL_LIBDIR}
51 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" )