如何在CMake中链接-lpthread -lm -ldl

时间:2016-07-21 11:23:40

标签: cmake intel-mkl

我正在尝试使用cmake链接intel mkl以获取我的代码。从mkl link advisor,我应该通过以下方式链接库:

func downloadViewAction(sender: UIButton)
    {
        sender.selected = true
        sender.setTitleColor(utility!.uicolorFromHex(0xf8f8f8), forState: UIControlState.Selected)
        let image:UIImage = UIImage(named: "DownloadSelected")!

        sender.setImage(image, forState: UIControlState.Selected)
        sender.backgroundColor = utility!.uicolorFromHex(0x006747)
        sender.layer.borderColor = utility!.uicolorFromHex(0x006747).CGColor

        print("inside ownload action view")
        let splitView:UISplitViewController = DevelopmemtSplitViewController()
        if let path = tablePropertyList.indexPathForSelectedRow {
            let selectedproperty = propertyArray[path.row]
            self.showActivityIndicator(splitView.view, message: "Downloading properties for "+selectedproperty)
        }
    }

然后我编写了一个模块,在Findmkl.cmake中找到 -L${MKLROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_sequential -lpthread -lm -ldl mkl_intel_lp64mkl_core

mkl_sequential

然后我可以链接这些库。虽然我不知道如何链接find_library(lp64_libraries NAMES mkl_intel_lp64 PATHS "${mkl_path}/lib/intel64") find_library(core_libraries NAMES mkl_core PATHS "${mkl_path}/lib/intel64") find_library(sequential_libraries NAMES mkl_sequential PATHS "${mkl_path}/lib/intel64") ,但我不确定这个链接是什么意思,我在$ MKLROOT / lib / intel64中找不到任何libpthread.a。

1 个答案:

答案 0 :(得分:3)

每个Unix系统上都应该存在这些库。

所以你可以添加:

target_link_libraries(target_name m dl pthread)