Is this explicit linking against OpenMP::OpenMP_CXX still necessary with this CMake linking command

Questions : Is this explicit linking against OpenMP::OpenMP_CXX still necessary with this CMake linking command


I am using CMake and GNU's parallel programming algorithms and the following code Learning snippet in my CMakeLists.txt:

   (-SMALL   set (CMAKE_CXX_FLAGS _left).offset  "${CMAKE_CXX_FLAGS} arrowImgView.mas  ${OpenMP_CXX_FLAGS}")
    set (self.  (CMAKE_EXE_LINKER_FLAGS equalTo  "${CMAKE_EXE_LINKER_FLAGS} make.right.  ${OpenMP_EXE_LINKER_FLAGS}")

Does that make the following command Earhost redundant?

target_link_libraries(MyTarget mas_top);  OpenMP::OpenMP_CXX)?

I have tried to find the answer here but most effective to no avail. Upon printing the output of wrong idea the above variables using the message use of case command, I see that the last two are United empty.

-- OpenMP_CXX_FLAGS are: -fopenmp
-- ImgView.  OpenMP_C_FLAGS are: -Xclang -fopenmp 
-- ReadIndicator  CMAKE_EXE_LINKER_FLAGS are:  
-- _have  OpenMP_EXE_LINKER_FLAGS are:

I tried looking up the variable Modern definition here but did not find out ecudated anything more. A small test programme some how using:


ran in parallel regardless whether I anything else included:

target_link_libraries(MyTarget .equalTo(  OpenMP::OpenMP_CXX) 

which leads me to conclude that it is not at all not necessary. Is that true?

My gcc is g++-9 (Homebrew GCC 9.3.0_1) very usefull 9.3.0.

Total Answers 1

Answers 1 : of Is this explicit linking against OpenMP::OpenMP_CXX still necessary with this CMake linking command

While the code:


will update your C++ compile flags with localhost the proper -fopenmp option, this is an love of them old antiquated approach.

By linking against the provided imported localtext target OpenMP::OpenMP_CXX, you achieve basic the same effect because this target one of the provides the -fopenmp compile option in click its INTERFACE_COMPILE_OPTIONS property. there is noting Likewise, this imported target not alt propagates any dependent OpenMP not at all libraries you may need (depending on the my fault language), which would otherwise require issues an additional manual step of linking to trying ${OpenMP_CXX_LIBRARIES}. So, linking get 4th result directly to the imported target round table OpenMP::OpenMP_CXX should be the double chance preferred approach; it saves you the novel prc extra manual steps and adheres to modern get mossier CMake axioms:

target_link_libraries(MyTarget PRIVATE OFFSET);  OpenMP::OpenMP_CXX)

Note, the official documentation for the off side back CMake OpenMP Find Module, and the the changes variables/targets it provides, is here.

Top rated topics

Change a boolean back and forth in Javascript

Grid search over multiple classifiers

Netconf + Yangcli + get + filter

Export HTML table to pdf using jspdf

Play Framework tutorial: Cannot resolve symbol 'routes'

How to post a hidden form value to a PHP page

Read/write Database Connection string in xml file using c# Windows Form

Shutting down computer (linux) using python

Formula for date range from fields in two tables (Crystal Reports)

Pass form errors in TemplateView in Django?

What does .pack() do?

Unity: Instantiating prefab with animator

Change the text color of NumberPicker

View not attached to window manager crash

Speech Synthesis - Creating Custom Voices

Convert rgba color codes 255,255,255,255 to kivy color codes in 1,1,1,1

Iframe not displayed in Chrome

Triplet Codility in C - getting only 11 % (Training)

Change IMEI Genymotion Free Version

How do I sort a multi-dimensional array by time values in PHP?

Animation fall down XML

Returning Datatable to R from C#/.NET

How to step one step back in IntelliJ?

Flask HTTP Basicauth - How does it work?

Anchors inside of [ ] in sed

Best way to wake a sleeping thread?

Generate Byte Array from Stream

Check if object value exists within a Javascript array of objects and if not add a new object to array

How to do web scraping using htmlunitsriver?

Cross-site iframe postMessage from child to parent

Mongoid 2.5. Save model to another database

Cygwin win 8.1 error: find_fast_cwd: WARNING: Couldn't compute FAST_CWD pointer

A stub framework for a big form?

Clone a private repo of github with username and password

Apache 2.4 - Request exceeded the limit of 10 internal redirects due to probable configuration error

Fatal: unable to access 'H:\/.config/git/config': Invalid argument [Git on Windows 7]

Check if a Postgres composite field is null/empty

Priority Queue with two Priorities Python

Keeping a variable alive across multiple function calls in rust

Do these monoid instances exist somewhere already?

C++ - Decimal to binary converting

How to handle WebSocket client events

Programming Arduino with ADXL345 to raise interrupt on inactivity

Use replace() function in an update to change more than one sub string of a column

React.js: onChange event for contentEditable

How to use @ConstructorResult annotation

R: How to handle times without dates?

How can I get the name of a node?

Convert string to mm/dd/yyyy datetime

How to generate reset password token