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 target_link_libraries(ompd omp) # ensure generated import library is created first
18 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
20 set(LIBOMPD_LD_STD_FLAGS FALSE CACHE BOOL
21 "Use -stdlibc++ instead of -libc++ library for C++ ")
23 if(${LIBOMPD_LD_STD_FLAGS})
24 # Find and replace/add libstdc++ to compile flags
25 STRING( FIND "${CMAKE_CXX_FLAGS}" "-stdlib=libc++" OUT )
26 if("${OUT}" STREQUAL "-1" )
27 set (CMAKE_CXX_FLAGS "-stdlib=libstdc++ ${CMAKE_CXX_FLAGS}")
29 STRING( REPLACE "-stdlib=libc++" "-stdlib=libstdc++" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} )
32 # Find and replace/add libstdc++ to loader flags
33 STRING( FIND "${CMAKE_SHARED_LINKER_FLAGS}" "-stdlib=libc++" OUT )
34 if("${OUT}" STREQUAL "-1" )
35 set (CMAKE_SHARED_LINKER_FLAGS "-stdlib=libstdc++ ${CMAKE_SHARED_LINKER_FLAGS}")
37 STRING( REPLACE "-stdlib=libc++" "-stdlib=libstdc++" CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} )
42 ${CMAKE_CURRENT_SOURCE_DIR}
48 LIBRARY DESTINATION ${OPENMP_INSTALL_LIBDIR}
49 ARCHIVE DESTINATION ${OPENMP_INSTALL_LIBDIR}
50 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" )